home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / database / eb106a.zip / PACK1.PRG / EB3.REP (.txt) < prev    next >
PC-File  |  1996-04-02  |  202KB  |  4,131 lines

  1.       
  2.                   EASY BASE PROGRAMMERS REFERENCE
  3.                             Contents
  4.       
  5.                   Procedure Commands            Page
  6.                   
  7.                   Clear Records From             11
  8.                   Copy All From                  14
  9.                   Create Temp As                 15
  10.                   Declare                        27
  11.                   Delay                          30
  12.                   Delete Record                  32
  13.                   Derive Off                     33
  14.                   Display Status                 36
  15.                   Do..Loop                       37
  16.                   Escape On/Off                  39
  17.                   Exit Batch Menu                40
  18.                   Exit Procedure                 41
  19.                   For..Next                      48
  20.                   If Then Else                   61
  21.                   Index Off                      63
  22.                   List Variables                 73
  23.                   Lock / Unlock                  74
  24.                   Manual Feed                    79
  25.                   Multiple Lines                 86
  26.                   Next Batch                     87
  27.                   Odd/Even Page Print            88
  28.                   Pack                           97
  29.                   Pause On/Off                  100
  30.                   Preselect                     102
  31.                   Print                         103
  32.                   Printer Control               104
  33.                   Recall Input Screen           110
  34.                   Remark                        112
  35.                   Reset Sequence                113
  36.                   Run                           121
  37.                   Show Picklist                 128
  38.                   Skip Group                    130
  39.                   Skip Record                   131
  40.                   Subindex                      137
  41.                   Update Record                 147
  42. ................................................................................
  43.                   Functions                     Page
  44.                   
  45.                   Abs                             1
  46.                   Chr$                           10
  47.                   Datetext                       23
  48.                   Dayofmonth                     24
  49.                   Dayofweek                      25
  50.                   Dayofyear                      26
  51.                   Default                        28
  52.                   Hours                          59
  53.                   If                             60
  54.                   Intext                         68
  55.                   Jointext                       69
  56.                   Lefttext                       70
  57.                   Lengthtext                     71
  58.                   Lookup                         75
  59.                   Lower                          76
  60.                   Makedate                       77
  61.                   Maketime                       78
  62.                   Maths                          80
  63.                   Midtext                        82
  64.                   Minutes                        83
  65.                   Mod                            84
  66.                   Month                          85
  67.                   Proper                        106
  68.                   Random                        107
  69.                   Retail                        115
  70.                   Reverse                       117
  71.                   Righttext                     118
  72.                   Round                         119
  73.                   Seconds                       123
  74.                   Spacepad                      132
  75.                   Spellday                      133
  76.                   Spellmonth                    134
  77.                   Stringof                      136
  78.                   Timeampm                      144
  79.                   Upper                         148
  80.                   V.A.T. Functions              149
  81.                   Year                          151
  82.                   Zeropad                       152
  83.                   Operators                     Page
  84.                   
  85.                   Arithmetic                     92
  86.                   Logical                        94
  87.                   Relational                     93
  88. ................................................................................
  89.                   Utilities                     Page
  90.                   
  91.                   Alter Vat Rates                 2
  92.                   Backup Application              4
  93.                   Change Password                 8
  94.                   Data Import                    20
  95.                   Delete Choice Lists            31
  96.                   Install Form                   64
  97.                   Install Printer                65
  98.                   Install Procedure              66
  99.                   List File Names                72
  100.                   Options                        95
  101.                   Pack Data Forms                98
  102.                   Rebuild Directories           109
  103.                   Restore                       114
  104.                   Screen Colours                122
  105.                   Set Paper Length              126
  106.                   Field Types                   Page
  107.                   
  108.                   Choice                          9
  109.                   Date                           22
  110.                   Fixed Point                    46
  111.                   Floating Point                 47
  112.                   Formatted Text                 54
  113.                   Integer                        67
  114.                   Text                          141
  115.                   Text Block                    142
  116.                   Time                          143
  117.                   Field Derivation Prefixes     Page
  118.                   
  119.                   Autodial                        3
  120.                   Current                        16
  121.                   Disable                        34
  122.                   Goto (Field) Next              57
  123.                   Help                           58
  124.                   Retest                        116
  125.                   Start Here                    135
  126.                   User Menu Functions           Page
  127.                   
  128.                   Menu Calls                     81
  129. ................................................................................
  130.                   System Values                 Page
  131.                   
  132.                   Blank.                          6
  133.                   Bottom Margin                   7
  134.                   Current Record                 17
  135.                   Cur_fld                        19
  136.                   File_date File_time            42
  137.                   File_len                       43
  138.                   File_pos                       44
  139.                   Fun_key                        55
  140.                   Global Number                  56
  141.                   Output                         96
  142.                   Page Number                    99
  143.                   Pi                            101
  144.                   Prog_dir                      105
  145.                   Record Number                 111
  146.                   Sequence                      125
  147.                   System Date                   139
  148.                   System Time                   140
  149.                   Total Copies                  145
  150.                   Total Records                 146
  151.                   File Commands
  152.                   
  153.                   Close                          13
  154.                   Erase                          38
  155.                   Find                           45
  156.                   Open                           91
  157.                   Read                          108
  158.                   Seek                          124
  159.                   Shell                         127
  160.                   Write                         150
  161.                   Field Controls                Page
  162.                   
  163.                   Beep                            5
  164.                   Clearfields                    12
  165.                   Cursor                         18
  166.                   Delay                          29
  167.                   Disable                        35
  168.                   Run                           120
  169. ................................................................................
  170.       ABS                  
  171. FUNCTION        
  172.       This function returns the absolute (positive) value of a
  173.       number.
  174.       Ex. abs(length - breadth)
  175.          This returns 6 if length = 12 and breadth = 6
  176.          or if length = 6 and breadth = 12
  177.       Acceptable parameters
  178.       Numeric value
  179.       Numeric expression
  180.       Numeric field/variable
  181.       Any function which returns a numeric value
  182.                                 - 1 -
  183. ................................................................................
  184.       ALTER VAT RATES      
  185. UTILITY         
  186. ALTER VAT RATES
  187.       The five VAT rates used by the VAT functions can be altered
  188.       either from the utilities menu or from a user menu function.
  189.       Just select "Alter VAT rates" - edit the percentages and press
  190.       F2 to save the new values.
  191.                                 - 2 -
  192. ................................................................................
  193.       AUTODIAL             
  194. DERIVATION PREFIX   
  195. AUTODIAL
  196.       Easy Base will dial (via a Hayes compatible modem) direct from
  197.       any form or procedure input screen.
  198.       To use the Auto dialling facility, all you have to do is place
  199.       the "autodial" keyword in the derivation of the field which
  200.       contains the telephone number. If the field already has a
  201.       derivation then add "autodial" as a prefix.
  202.       Ex. Autodial Lookup(customers,phone)
  203.       To initiate the call type Ctrl + D.
  204.       By default Easy Base uses tone dialling via COM1. If your modem
  205.       is connected to COM2 you can set this up from the Options item
  206.       on the Utilities menu.
  207.       If your exchange does not recognize tone dialling then you can
  208.       pulse dial by pressing Ctrl + P.
  209.       If you operate from a private exchange and have to wait for an
  210.       outside line after dialling 9 then place a "W" between the 9
  211.       and the rest of the number.
  212.       Note:-
  213.       1.   You can have more than one prefix on any one field
  214.            derivation provided there is a space between each.
  215.       2.   The Autodial prefix cannot be tested in derivation test
  216.            mode.
  217.                                 - 3 -
  218. ................................................................................
  219.       BACKUP APPLICATION   
  220. UTILITY         
  221. BACKUP APPLICATION
  222.       Easy Base includes an inbuilt Backup system for your
  223.       applications and data.
  224.       If you select "Backup Application" from the utilities menu then
  225.       Easy Base will backup your entire application - Choicelist
  226.       fields - Forms - Data and procedures. The backup system will
  227.       split large files across multiple disks automatically.
  228.       When an application is finished and you have backup copies then
  229.       backing up choice lists and procedures is wasteful of time and
  230.       floppies. You can backup only the users data by calling "Backup
  231.       Data" from a user menu.
  232.       Backup Principles.
  233.       The reason for a backup is that in the event of a computer or
  234.       hard disk failure you will have your application or data to
  235.       restore on the new machine.
  236.       If you have no backup and your machine fails then you have lost
  237.       all your data. If you have only one backup and your machine
  238.       fails while doing a backup then you have lost all your data.
  239.       The principle of safe backing up is to keep two sets of backup
  240.       disks in separate boxes marked "Latest" and "Previous".
  241.       Whenever you do a backup you use the disks from the "Previous"
  242.       box - move the disks from the "Latest" to the "Previous" and
  243.       put your new backups in the latest box when completed.
  244.       This not only overcomes the problem of a failure during backup
  245.       but also provides a secondary set of disks if any of the
  246.       "Latest" disks turn out to be faulty when you come to restore.
  247.       If you ever have to use a backup disk and find that it has
  248.       developed a bad sector then you can attempt a recovery with a
  249.       utility such as "Norton" Disk Test. Easy Base leaves
  250.       approximately 5K of unused disk space on all backup disks so
  251.       that such a utility has somewhere to move bad sectors to.
  252.       To save disk space, Easy Base does not backup index files. If
  253.       you ever have to use a backup disk then the index files are
  254.       rebuilt after restoring the data.
  255.       See Also:-  Restore
  256.                                 - 4 -
  257. ................................................................................
  258.       BEEP                 
  259. FIELD CONTROL     
  260.       The "beep" control is used in field derivations to alert the
  261.       user to input errors. In addition to sounding the beeper the
  262.       "beep" control has two optional additional parts - A message to
  263.       be sent to the message line and cursor redirection. This is
  264.       normally to the field in which the error has been made but can
  265.       be to any field.  Field controls are appended to field
  266.       derivations and are enclosed in square brackets.
  267.       Ex.  If(partno < 0,blank[beepPart Numbers must not be
  268.       negativeCursor partno],partno)
  269.       In this example, if the user enters a negative number in the
  270.       partno field the computer will beep,the number will be cleared
  271.       from the field, the message "Part Numbers must not be negative"
  272.       will be displayed on the message line and the cursor will
  273.       return to the "partno" field.
  274.       Ex. If(paid = "no" and chequeno <> blank,paid[beepEither bill
  275.       has been paid or cheque number entered in errorCursor
  276.       paid],paid)
  277.       In Easy Base, division by zero is not trapped as an error.
  278.       There is a very good reason for this.  When you start a new
  279.       record and all the fields are blank then any field which
  280.       provides a value for a division in another field would cause a
  281.       division by zero error before its value had been entered.
  282.       Whenever Easy Base encounters a division by Zero it divides by
  283.       one instead.  This is perfectly acceptable in most business
  284.       applications.  However, if you need to be warned of a division
  285.       by zero in formulae then you can provide your own error trap
  286.       using the "Beep" control.
  287.       Ex.
  288.          If( T4 = 0,blank[beepDivision by Zero Value from Field T4],
  289.                       T4)
  290.       NETWORK VERSIONS
  291.       From the release of Network V1 there is also a Beep command in
  292.       the procedure language.
  293.       See Example under "Recall Input Screen"
  294.                                 - 5 -
  295. ................................................................................
  296.       BLANK.               
  297. SYSTEM VALUE      
  298. BLANK.
  299.       In Easy Base the value of any field which does not contain
  300.       characters is represented by the word "Blank" irrelevant of
  301.       data type.
  302.       A numeric field returns the value "Blank" only when the field
  303.       is empty. If it has a value of zero then it is NOT blank.  In
  304.       fact, the main advantage of recognizing "Blank" is that you can
  305.       distinguish between zero value and empty numeric fields.
  306.       There is, however, one slight disadvantage.  If a text field
  307.       contains ONLY the word blank and you use its value in a
  308.       derivation then the word "Blank" from the field will disappear.
  309.       The "Name" field at the top left hand side of this page is
  310.       derived by the formula Upper(Name).  You will notice that
  311.       "Blank" is followed by a full stop.  If it were not then the
  312.       upper function would return "                    ".
  313.       You can also remove a fields contents by setting it equal to
  314.       blank.
  315.                                 - 6 -
  316. ................................................................................
  317.       BOTTOM MARGIN        
  318. SYSTEM VALUE      
  319. BOTTOM MARGIN
  320.       Throughout a procedure which has a printed output, Easy base
  321.       keeps track of the length of page remaining (in inches) in the
  322.       system value "Bottom Margin". The Bottom margin value is used
  323.       to control pagination in procedures which "Report" on data.
  324.       The "Bottom Margin" value is based on the paper type entered
  325.       from the Utilities Menu. You must set the type of paper you are
  326.       using before using "Bottom Margin".
  327.       Ex.
  328.       Line feed: Line feed: Line feed
  329.       For employees
  330.          print list items
  331.          if bottom margin < .5 then
  332.             page feed: line feed :line feed : line feed
  333.          else
  334.             line feed
  335.          end if
  336.       next
  337.       In the above example the list items section is printed with a
  338.       blank line between each and with a half inch top and bottom
  339.       page margin.
  340.       When you base decisions on the "Bottom margin" value you should
  341.       always do so with a "Greater Than" or "Less Than" operator. If
  342.       you used " If Bottom margin = .5 then Page feed" your page
  343.       would only be ejected if and when the "Bottom Margin" value was
  344.       exactly 0.5  As most printing is done at six lines to the inch
  345.       it is most unlikely that the "Bottom margin" value would ever
  346.       be half an inch.
  347.                                 - 7 -
  348. ................................................................................
  349.       CHANGE PASSWORD      
  350. UTILITY         
  351. CHANGE PASSWORD
  352.       You can change your developers access password with this item
  353.       on the utilities menu.
  354.                                 - 8 -
  355. ................................................................................
  356.       CHOICE               
  357. FIELD TYPE       
  358. CHOICE
  359.       If you define a field as the "Choice" type a window will open
  360.       into which you can type up to thirty four different choices.
  361.       When you have entered your choices you will be asked to give a
  362.       name to your choice list. Once a choice list has been saved it
  363.       can be used in any other choice field in any other form or
  364.       input screen.
  365.       Once a choice list has been saved you can edit the contents but
  366.       not the field length. Editing a choice list in one form
  367.       automatically edits it for any other form.
  368.       If you need to alter a list such that the field length will
  369.       change then you must create a new list. You can erase the old
  370.       one from the utilities menu.  If the list is used in more than
  371.       one form then you must redefine it in all the other forms in
  372.       which it is used
  373.       When the cursor enters a choice field your choice list will be
  374.       displayed for the user to choose from. He cannot enter any
  375.       value other than one from the list.
  376.       When the cursor enters a choice field that is blank, the list
  377.       will pop up for the user to choose from. If there are more than
  378.       nine choices on the list then only the first nine will display
  379.       automatically. For up to nine choices the user can pick one by
  380.       pressing the number of the choice or leave the field blank by
  381.       simply moving the cursor. If there are more than nine choices
  382.       then the entire list can be displayed by pressing the space
  383.       bar. When a list of more than nine is displayed the user must
  384.       select a choice or press the Escape key.
  385.       When the cursor re enters a choice field in which a choice has
  386.       already been made the same events occur except that in the case
  387.       of a two choice list the two choices are toggled on the space
  388.       bar without actually being displayed.
  389.                                 - 9 -
  390. ................................................................................
  391.       CHR$                 
  392. FUNCTION        
  393.       The Chr$ function returns the character whose ASCII number is
  394.       supplied as the parameter.
  395.       Ex.   Chr$(171)
  396.             < Returns "
  397.       Ex.   Jointext(Chr$(227),"r",Chr$(253))
  398.             < Returns "
  399.       In Easy Base, text fields are automatically justified left.
  400.       This is desirable in record entry as it prevents the user from
  401.       entering leading spaces in indexed fields and consequently
  402.       trashing alphabetic printouts. However, you may wish to right
  403.       justify or centre justify text in printouts. For example, the
  404.       righthand "Chr$" at the top of this page is right justified in
  405.       its field. You can use the ASCII character 255 to achieve right
  406.       or centre justification.
  407.       Ex.
  408.       Heading = jointext(stringof((30-lengthtext(name))/2,Chr$(255)),
  409.       name)
  410.           < This centres name in the 30 character field "heading">
  411.       Ex.
  412.       Heading =Jointext(stringof(40-lengthtext(name),Chr$(255)),name)
  413.          < This right justifies name in a 40 character field
  414.            "Heading">
  415.       CAUTION:
  416.       You can produce any ASCII character ( 0 - 255 ) with the Chr$
  417.       function. ASCII characters 0 to 31 are used as printer controls
  418.       and although you can use them freely on screen you should never
  419.       include them in a procedure output which will be sent to the
  420.       printer.
  421.       The ASCII character 127 is used internally by Easy Base to
  422.       replace quotation marks within quoted text. It should not be
  423.       used for any other purpose.
  424.       Acceptable parameters:
  425.       Numeric value, field, variable, expression or function
  426.       returning a number between 0 and 255
  427.                                 - 10 -
  428. ................................................................................
  429.       CLEAR RECORDS FROM   
  430. PROCEDURE COMMAND   
  431. CLEAR RECORDS FROM
  432.       The "Clear Records From" command clears all records from a form
  433.       by erasing its data and index files. If you need to erase all
  434.       records form a form always use the "Clear Records" command
  435.       rather than "Delete Record" command. It is much faster and does
  436.       not require the form to be re-packed afterward.
  437.       Ex.
  438.       If input.confirm = "yes" then clear records from invoices
  439.                                 - 11 -
  440. ................................................................................
  441.       CLEARFIELDS          
  442. FIELD CONTROL     
  443. CLEARFIELDS
  444.       The "Clearfields" control blanks out all other fields on a form
  445.       or procedure input screen whenever the field containing the
  446.       control is changed.
  447.       The primary use for the "Clearfields" control is to force
  448.       default lookups to re-derive for procedures which edit data.
  449.       For Example - If you wrote a procedure to alter customers
  450.       addresses and telephone numbers then you would have three
  451.       fields on the input screen.
  452.       Accountno   derived   lookup(customers,accountno)
  453.       address     derived   default(lookup(customers,address))
  454.       Tel         derived   default(lookup(customers,tel))
  455.       When you enter a customers account number, his old address and
  456.       telephone number will be looked up, but the "Default" function
  457.       will allow you to edit them. The procedure code would then
  458.       update the record with the new address and phone number.
  459.       The problem is, that having entered an account number and
  460.       looked up the other fields, if you then realize you have
  461.       entered the wrong account number and change it, the other
  462.       fields will not re-derive because they now have a default
  463.       value.  To get them to lookup based on the new account number
  464.       you would have to take the cursor to each field and clear it
  465.       with the F6 key.
  466.       you can automate this process by adding the "Clearfields"
  467.       control to the accountno derivation:-
  468.       lookup(customers,accountno)[clearfields]
  469.       Note:  The "Clearfields" control will only work when appended
  470.       to a derivation which is already dependent on the value of the
  471.       field. If you want to clear fields based on a change to a field
  472.       which has no other derivation then you must derive the field
  473.       with its own name plus the "Clearfields" control.
  474.       In a field "Number" the derivation - Number[clearfields] - will
  475.       clear all other fields when the "Number" field is edited but
  476.       the derivation [clearfields] will have no effect.
  477.                                 - 12 -
  478. ................................................................................
  479.       Close                
  480. File Command      
  481. Close
  482.       The "Close" command closes a non Easy Base file which has been
  483.       opened with the "Open" command.
  484.       If a procedure only opens a single external file then the close
  485.       command can be ommitted, but if several files are opened within
  486.       a procedure then each must be closed before the next is opened.
  487.       You can only have one external file open at any one time.
  488.       ....................
  489.       declare output fields
  490.          Files : Path
  491.       end
  492.       declare variables
  493.         Ln as text
  494.       end
  495.       Open  "C:\CONFIG.SYS"
  496.       do
  497.          Read line to Ln
  498.          if lefttext(Ln,6) = "files=" then exit do
  499.       Loop
  500.       Files = Ln
  501.       Close
  502.       Open "C:\AUTOEXEC.BAT"
  503.       Do
  504.          read line to Ln
  505.          if Lefttext(Ln,4) = "path" then exit do
  506.       Loop
  507.       Close
  508.       Path = Ln
  509.       Print List Items
  510.       See also: Open, Seek, Read, Write, Find, Erase
  511.                                 - 13 -
  512. ................................................................................
  513.       COPY ALL FROM        
  514. PROCEDURE COMMAND   
  515. COPY ALL FROM
  516.       When you are transferring values from the fields of one form to
  517.       the fields of another in preparation for a "New Record" or
  518.       "Update Record"  you can use "Copy All From" to save time.
  519.       Ex.
  520.       for invoiceitems new record
  521.          invoiceitems.item = input.item
  522.          invoiceitems.price = input.price
  523.          invoiceitems.quantity = input.quantity
  524.          invoiceitems.vatrate = input.vatrate
  525.       next
  526.       can be replaced with:-
  527.       for invoiceitems new record
  528.          copy all from input
  529.       next
  530.       The data transfer in a "Copy All From" is based on the source
  531.       and destination fields having the same name.
  532.       If the source and destination fields have different data types
  533.       Easy Base will attempt a conversion.
  534.       The conversion will succeed between different numeric types and
  535.       from numeric to text. It will fail from text to numeric and
  536.       between any mismatch of date and time.
  537.       See also:-  Derive Off, Duplicate Prevention
  538.                                 - 14 -
  539. ................................................................................
  540.       CREATE TEMP AS       
  541. PROCEDURE COMMAND   
  542. CREATE TEMP AS
  543.       The "Create Temp As" command makes a temporary form during a
  544.       procedure. There are two main uses for the temporary form.
  545.       1.  To physically sort the records in a form.
  546.       Ex.
  547.       create temp as addresses
  548.       index off:pause off:escape off:derive off
  549.       for addresses with surname in order
  550.          for temp new record
  551.             copy all from addresses
  552.          next
  553.       next
  554.       rename temp as addresses
  555.       The other main use for the temporary file is to save time when
  556.       the majority of records in a form are to be deleted.
  557.       Ex.
  558.       A purchases ledger form is to be cleared down at the year end
  559.       but any unreconciled payment entries are to be retained and
  560.       flagged as last years. If there were 15000 records in the form
  561.       of which only 50 were unreconciled then the procedure
  562.       for purchases
  563.          if purchases.reconciled = "yes" then
  564.             delete record
  565.          else
  566.             purchases.lastyear = "yes"
  567.             update record
  568.          end if
  569.       next
  570.       would not only take a very long time to run but would leave the
  571.       form full of deleted records and it would have to be re-packed.
  572.       The same result can be achieved very quickly and without the
  573.       need to re-pack with the following procedure.
  574.       create temp as purchases
  575.       for purchases with reconciled = "no"
  576.          for temp new record
  577.             copy all from purchases
  578.             temp.lastyear = "yes"
  579.          next
  580.       next
  581.       rename temp as purchases
  582.       Do not use the "Clear Records" command to wipe the old file
  583.       before using "Rename Temp As".  If you suffered a power failure
  584.       after clearing and before renaming you would lose your data.
  585.                                 - 15 -
  586. ................................................................................
  587.       CURRENT              
  588. DERIVATION PREFIX   
  589. CURRENT
  590.       In Easy Base, fields are not normally derived when a previously
  591.       entered record is viewed on screen. You can force a field to be
  592.       rederived when viewed by prefixing the derivation with
  593.       "current".
  594.       Ex.  An invoice form has three fields Ivdate,Cdate and age.
  595.       Ivdate is derived as   "system date"
  596.       Cdate is derived as    "current system date"
  597.       age is derived as      jointext(Cdate-Ivdate," Days old")
  598.       Each time a record is viewed the Cdate field is rederived with
  599.       the current system date and the age field shows the number of
  600.       days since the record was filed.
  601.       Ex.
  602.       A form is used to price a certain job. It consists of fields
  603.       for materials and their prices which are looked up from a
  604.       "stock" form. If the primary lookup fields are prefixed with
  605.       "current"   -  "current lookup(stock,item)"
  606.       then each time a record is viewed it will reprice the job using
  607.       the latest prices from the "stock" file.
  608.       Please note that in the case of lookups, prefixing a secondary
  609.       lookup has no effect. In the above example
  610.         "current lookup(stock,price)"  would not work
  611.       Provided that the primary lookup field is prefixed with
  612.       "current" then any secondary lookups will also be rederived.
  613.       The values of "Current" fields are also rederived whenever they
  614.       are accessed in procedure code but they are NOT REDERIVED when
  615.       they are accessed by a Lookup function.
  616.       1. You can have more than one prefix on any one field
  617.          derivation provided there is a space between each.
  618.                                 - 16 -
  619. ................................................................................
  620.       Current Record       
  621. SYSTEM VALUE      
  622. Current Record
  623.       Whenever a procedure is processing a "For" loop the number of
  624.       the record being processed is available in the system value
  625.       "Current Record".
  626.       NETWORK VERSIONS
  627.       From the release of Network V1 the system value Current Record
  628.       has been replaced by a pseudo field Form.Record Number
  629.                                 - 17 -
  630. ................................................................................
  631.       Cursor               
  632. FIELD CONTROL     
  633. Cursor
  634.       The field control "Cursor" sends the cursor to the named field.
  635.       if(condition,fieldname[cursor fieldname2],fieldname)
  636.       The cursor control can also be embedded in the beep control.
  637.       See also "Beep"
  638.                                 - 18 -
  639. ................................................................................
  640.       Cur_Fld              
  641. SYSTEM VALUE      
  642. Cur_Fld
  643.       The System value Cur_Fld holds the number of the field which
  644.       the cursor is in.
  645.       The Cur_Fld value can be used in form and input screen
  646.       derivations to create pop up prompt fields or to change
  647.       additional help fields.
  648.       if(Cur_Fld > 2,"Enter the price",blank)
  649.       If(Cur_Fld < 7,"Help for first six fields",Help for later
  650.       fields")
  651.       The Cur_Fld value can also be used to delay lookups when a
  652.       screen first loads.
  653.       if(Cur_Fld < 5,blank,lookup(customers,name))
  654.       In the case of input screens the value is also carried forward
  655.       to the procedure code so you can tell which field the cursor
  656.       was in when the procedure was run.
  657.                                 - 19 -
  658. ................................................................................
  659.       Data Import          
  660. UTILITY         
  661. Data Import
  662.       There are four Data Import routines in Easy Base. The first
  663.       imports data from files which conform to the Xbase standard
  664.       first introduced by Dbase. The second imports data from "Comma
  665.       Delimited" files. This is the standard used by most sequencial
  666.       access and non relational data systems. The third routine
  667.       imports data from fixed length record text files. This is the
  668.       format which is used by all systems to output data. You can
  669.       therefore import data from virtually any other system by first
  670.       reporting on it to a disk file and then importing it with the
  671.       fixed length ASCII import routine. The fourth routine imports
  672.       one ASCII line per field.
  673.       XBASE
  674.       If the data you wish to import is in Xbase format, Easy Base
  675.       will report the structure of the file. You can print this out
  676.       by pressing F10. You now design a form to hold the imported
  677.       data. The names that you give to the Easy Base fields do not
  678.       have to be the same as the Xbase field names but they must be
  679.       in the same order. If the Xbase fields are text then the Easy
  680.       Base fields must be the same length. If the Xbase fields are
  681.       numeric then the Easy Base fields must be numeric. It does not
  682.       matter if they are different lengths and any of the three
  683.       types, integer, fixed point or floating point can be used.
  684.       If an Xbase field is a date field then it must be imported to
  685.       an eight character text field in Easy Base. You can reformat it
  686.       to an Easy Base date field after importation (See the Method -
  687.       Data Type Conversion).  Easy Base does not support "Memo" data.
  688.       If the Xbase file has a memo field you can still import from it
  689.       but the memo field itself will be skipped by the import
  690.       routine.
  691.       COMMA DELIMITED
  692.       To import data from comma delimited files all you have to do is
  693.       design a form with the same number of fields as there are in
  694.       the file to be imported. Numeric fields can be any of the three
  695.       types and text fields should be long enough to hold the longest
  696.       data expected in the incoming field. If any of the fields to be
  697.       imported holds a date then it must be imported to a text field.
  698.       You can convert it to a date later.
  699.       FIXED LENGTH ASCII
  700.       To import data from fixed length ASCII files you must design a
  701.       form in which all fields are text and are exactly the same
  702.       length and in the same order as the fields in the file to be
  703.       imported. If the file to be imported has a header you can allow
  704.       for this by entering the header length in bytes.
  705.       If you are using the fixed length import routine to import data
  706.       which you have output as a report from another system then
  707.                                 - 20 -
  708. ................................................................................
  709.       Data Import          
  710. UTILITY         
  711. Data Import
  712.       please note the following points.
  713.       The output report from the original system should have no
  714.       headers, footers or left margin and there should be no spaces
  715.       between fields.
  716.       When the original system outputs the data it will add a
  717.       carriage return and line feed sequence to the end of each
  718.       record. When you design the form to import this data to, you
  719.       must have a final two character text field to trap this
  720.       sequence and maintain the same record length.  This field can
  721.       be deleted after importation.
  722.       All fields are imported as text. If any of them contain numeric
  723.       values which you wish to convert to numeric fields you must do
  724.       this after importation. (See Method Data Type Conversion)
  725.       ASCII LINE
  726.       The ASCII line import routine imports one line per field from
  727.       an ASCII text file. If you have one field on the form to which
  728.       you import then you will have one line per record. If you have
  729.       two fields on the form to which you import then you will have
  730.       two lines per record Etc.
  731.       The import routines are for loading entire data files into Easy
  732.       Base. For Flexible import and export to any part of any file
  733.       see the External File Commands documentation.
  734.                                 - 21 -
  735. ................................................................................
  736.       DATE                 
  737. FIELD TYPE       
  738.       Date fields hold dates in the eight character format 11/11/94
  739.       The assumed century runs from the first of January 1981 to the
  740.       31st of december 2080.
  741.       You can select whether you wish your dates to be displayed as
  742.       day/month/year (European) or month/day/year (North American)
  743.       from the "options" item on the utilities menu.
  744.       You can perform addition and subtraction operations on date
  745.       values in days.
  746.       Ex.  System date + 30
  747.       Arithmetic operations are only correct for the assumed century.
  748.       Date fields are automatically checked for validity by the
  749.       system.
  750.       Easy base does not provide a ready made ten character date
  751.       field but you can define one with the "Formatted Text" field
  752.       type.
  753.       See Also:-   Makedate
  754.                                 - 22 -
  755. ................................................................................
  756.       DATETEXT             
  757. FUNCTION        
  758. DATETEXT
  759.       This function returns the date parameter in the form:-
  760.       14th October 1994  or
  761.       October 14th 1994  depending on the date format selected in
  762.                          the utilities menu.
  763.       Ex.    datetext(system date)
  764.       Ex.    datetext(invoicedate + 30)
  765.       Acceptable parameters:
  766.       System date
  767.       Date field
  768.       Makedate function
  769.       Date expression
  770.                                 - 23 -
  771. ................................................................................
  772.       DAYOFMONTH           
  773. FUNCTION        
  774. DAYOFMONTH
  775.       This function returns the day no.(1-31) of the date parameter.
  776.       Ex. dayofmonth(system date)
  777.       Ex  dayofmonth(registered)
  778.       Ex.
  779.       if dayofmonth(system date) = 28 then
  780.          for statements with settled = "No"
  781.             statements.overdue = "Yes"
  782.             update record
  783.          next
  784.       end if
  785.       Acceptable parameters:
  786.       System date
  787.       Date field
  788.       Makedate function
  789.       Date expression
  790.                                 - 24 -
  791. ................................................................................
  792.       DAYOFWEEK            
  793. FUNCTION        
  794. DAYOFWEEK
  795.       This function returns the day no.(1-7) of the date parameter.
  796.       Ex.  dayofweek(system date)
  797.       Ex.  day = spellday(dayofweek(diary.date))
  798.       Ex.  The following procedure, if called from a batch execute
  799.       menu will only run on a Monday.
  800.       declare output fields
  801.          takings.date
  802.          takings.dailytotal
  803.       end
  804.       if dayofweek(system date) = 1 then
  805.          for takings with date in reverse order
  806.             print list items
  807.             if system date - takings.date > 7 then exit for
  808.          next
  809.       end if
  810.       Acceptable parameters:
  811.       System date
  812.       Date field
  813.       Makedate function
  814.       Date expression
  815.                                 - 25 -
  816. ................................................................................
  817.       DAYOFYEAR            
  818. FUNCTION        
  819. DAYOFYEAR
  820.       This function returns the day no.(1-365) of the date parameter.
  821.       Ex.   dayofyear(system date)
  822.       Ex.   days = dayofyear(events.date)
  823.       Acceptable parameters:
  824.       System date
  825.       Date field
  826.       Makedate function
  827.       Date expression
  828.                                 - 26 -
  829. ................................................................................
  830.       DECLARE              
  831. PROCEDURE COMMAND   
  832. DECLARE
  833.       If you write a procedure which outputs information to the
  834.       screen, printer or a disk file you must start it by declaring
  835.       the output fields.
  836.       Ex.
  837.       Declare output fields
  838.          Input.name
  839.          Customers.name:customers.address:customers.acno
  840.          countofinvoices
  841.       end
  842.       If fields you intend to print exist in a form then declare them
  843.       as Formname.Fieldname.  Fields from the procedures Input Screen
  844.       are declared as Input.fieldname. Easy Base will then use the
  845.       field definitions from the form as defaults when you create the
  846.       Output Format for the procedure.
  847.       If a field which you intend to print is to be derived during
  848.       the procedure and does not exist in a form as "countofinvoices"
  849.       you can give it any name you wish up to forty characters but
  850.       the name must not contain a ".". Once you have declared fields
  851.       you can create the Output Format.
  852.       If you declare an "Ad Hoc" field such as "countovinvoices" then
  853.       you must include it in the format in order to define its type
  854.       and length.
  855.       If you require variables to store values during a procedure but
  856.       you will not be out-putting their values then declare them as
  857.       variables not fields.
  858.       Ex.
  859.       declare variables
  860.          count as number
  861.          lasttype as text
  862.       end
  863.       Unprinted variables can only have one of the two types "Number"
  864.       or "Text".
  865.       Field declarations must precede Variable declarations and both
  866.       must precede executable code.
  867.                                 - 27 -
  868. ................................................................................
  869.       DEFAULT              
  870. FUNCTION        
  871. DEFAULT
  872.       This function returns the parameter if not overridden by user
  873.       entry.
  874.       Ex.    Default(5)
  875.       Ex.    Default(system date)
  876.       Ex.    Default(lookup(stock,price))
  877.       The Default function is only used in form and input screen
  878.       field derivations - It has no meaning in procedure code.
  879.       Acceptable parameters
  880.       Any value, expression, field, variable or nested function of
  881.       the same type as the field in which it is used.
  882.                                 - 28 -
  883. ................................................................................
  884.       DELAY                
  885. FIELD CONTROL     
  886. DELAY
  887.       The "delay" control suspends processing for a given number of
  888.       milliseconds.
  889.       Ex.
  890.       A procedure screen is used from a startup Batch execute menu as
  891.       an opening screen to an application and has the following field
  892.       derivations
  893.       1.  "Welcome to this wonderful program" [delay 1000]
  894.       2.  "Copyright Fred blogs"[delay 1000]
  895.       3.  "Press F2 to start"
  896.       If the field colours are "text" ,"alt1" or "alt2" then the
  897.       three fields will "Popup" with a one second delay between each.
  898.                                 - 29 -
  899. ................................................................................
  900.       DELAY                
  901. PROCEDURE COMMAND   
  902. DELAY
  903.       The "Delay" command suspends processing for a given number of
  904.       milliseconds (1 - 5000).
  905.       Ex.
  906.       declare variables
  907.          x as number : total as number
  908.       end
  909.       for customers
  910.          customers.balance = 0
  911.          for invoices with acno = customers.acno
  912.             display status "Totalling invoices for" + Customers.name
  913.             delay 200
  914.             customers.balance = customers.balance + invoices.total
  915.          next
  916.          update record
  917.       next
  918.       In the above example, wherever a customer only has one or two
  919.       invoices to total, the status display would change very
  920.       quickly.  By including a 200 millisecond delay you can ensure
  921.       that each customers name is on screen at least long enough to
  922.       be read.
  923.       Delay values outside of 1 - 5000 are ignored.
  924.       The delay parameter cannot be supplied as a variable.
  925.                                 - 30 -
  926. ................................................................................
  927.       DELETE CHOICE LISTS  
  928. UTILITY         
  929. DELETE CHOICE LISTS
  930.       If you have Choice lists for choice fields that are no longer
  931.       required you can delete them with this utility.
  932.                                 - 31 -
  933. ................................................................................
  934.       DELETE RECORD        
  935. PROCEDURE COMMAND   
  936. DELETE RECORD
  937.       The "Delete Record" command is used for the selective deletion
  938.       of records in a form.
  939.       Ex.
  940.       for books with title = input.title
  941.          delete record
  942.       next
  943.       This deletes the single book whose title is that entered on the
  944.       input screen.
  945.       for books with author = input.author
  946.          delete record
  947.       next
  948.       This deletes the records of all books by the author entered on
  949.       the input screen.
  950.       When you use the "Delete Record" command it has the same effect
  951.       as deleting a record in data entry. In other words the record
  952.       is marked for deletion but will not actually be removed from
  953.       the form until the next re-pack.
  954.       If you use the "Delete Record" command to delete large numbers
  955.       of records then you should pack the form afterward.
  956.       If you wish to delete all records in a form use the "Clear
  957.       records" command not the "Delete Record" command.
  958.                                 - 32 -
  959. ................................................................................
  960.       DERIVE OFF           
  961. PROCEDURE COMMAND   
  962. DERIVE OFF
  963.       Whenever an Easy Base procedure adds or updates a record then
  964.       by default it checks the derivations of all fields during an
  965.       add operation and any fields that are affected by an update
  966.       operation. In other words, if you update the netprice field in
  967.       a stock form and that form has derived fields for VAT and
  968.       grossprice then those fields will also be updated.
  969.       If the procedure adds or updates all fields then this process
  970.       is superfluous and simply slows the procedure. You can disable
  971.       form derivation checking with the "Derive Off" command.
  972.       derive off
  973.       for stock with item = input.item
  974.          copy all from input
  975.          update record
  976.       next
  977.       In the above example a stock form has several derived fields
  978.       but the input screen also does the same derivations. There is
  979.       therefore no need to re-check them when the record is updated.
  980.       As a general rule, in procedures which add or update records
  981.       from an input screen, you should derive all fields on the input
  982.       screen rather than during the update process. The user will not
  983.       notice the time taken to derive fields while he is filling them
  984.       in but he will notice the time taken to derive them after he
  985.       has pressed F2
  986.       There is no corresponding "Derive On" command. Derivation
  987.       checking is automatically turned back on at the end of the
  988.       loop to which is prefixed by the "Derive Off" command. If you
  989.       require derivation checking to be off for more than one loop in
  990.       a procedure then you must issue the command before each loop.
  991.       Note:-
  992.       If the "Derive Off" command is not issued before a loop then
  993.       form level derivations override procedure derivations. This is
  994.       not normally a problem, but can be if you try to change the
  995.       case of a field for printing.
  996.       For customers
  997.          customers.name = proper(customers.name)
  998.          print list items
  999.       next
  1000.       If the "Name" field on the "Customers" form is derived as
  1001.       Upper(name) then the procedure will print the customers names
  1002.       in upper case.  You can overcome the problem either by
  1003.       cancelling the field derivation or by transferring the
  1004.       customers name to a variable and converting that to proper.
  1005.                                 - 33 -
  1006. ................................................................................
  1007.       Disable              
  1008. DERIVATION PREFIX   
  1009. Disable
  1010.       When an Easy Base procedure has an input screen it can be run
  1011.       by pressing any of the function keys 2,4,5,7,8,9 or 10.
  1012.       Where a procedure only does one job, the fact that all keys
  1013.       will initiate it is not important. The default help line states
  1014.       F2 and you can replace this if you want the user to use
  1015.       another.
  1016.       If however you wish to disable function keys which your
  1017.       procedure does not use you can do so by adding the prefix
  1018.       "Disable" followed by the keys you wish to deactivate in
  1019.       quotation marks. You can also disable the Escape Key.
  1020.       Ex.
  1021.       Disable "5789"
  1022.       It does not matter which field you use the "Disable" prefix in
  1023.       and if the field already has a derivation formula it can
  1024.       follow.
  1025.       Disable "4578910Esc" lookup(units,price)
  1026.       In the above example the only active function key is F2 and the
  1027.       user cannot Escape to the menu. The procedure must be run.
  1028.       Disabling the Escape key is useful where a procedure is part of
  1029.       a chain, ie it is run by the run command from a main procedure
  1030.       or it is on a batch menu. You should be careful not to disable
  1031.       the Escape key on procedures that are stand alone with
  1032.       repeating input screens or on main procedures which run other
  1033.       procedures which in turn run the main procedure.
  1034.       Notes:
  1035.       1.  The Disable prefix has no meaning in data entry forms.
  1036.       2.  There must be a space between "Disable" and the key string.
  1037.           The key string must be in quotation marks.
  1038.       3.  You can combine prefixes in any field derivation provided
  1039.           there is a space between them
  1040.       Ex.
  1041.       Disable "4578910" Help "Press F2 when ready" Start Here
  1042.       See also: "Run" "Fun_Key" "Dissable Control"
  1043.                                 - 34 -
  1044. ................................................................................
  1045.       Disable              
  1046. FIELD CONTROL     
  1047. Disable
  1048.       The Disable control is used to change the disabled function
  1049.       keys from within field derivations in a procedure's input
  1050.       screen.
  1051.       Ex.
  1052.       if(actn = "new",actn[disable "4578910"],actn[disable "2"])
  1053.                                 - 35 -
  1054. ................................................................................
  1055.       DISPLAY STATUS       
  1056. PROCEDURE COMMAND   
  1057. DISPLAY STATUS
  1058.       If you write a procedure which has no output then Easy Base
  1059.       will display a "Running" flash at the top right hand side of
  1060.       the screen. For procedures which only take a few seconds to run
  1061.       this is sufficient to let the operator know that something is
  1062.       happening. For procedures that take some time to complete you
  1063.       should include a status display showing the progress of the
  1064.       procedure. A status display not only allays the nagging
  1065.       suspicion that the system has hung up but also allows the
  1066.       operator to estimate how long it will take.
  1067.       To create a status display just issue the command "Display
  1068.       Status" followed by a message composed of text in quotation
  1069.       marks and fields or variables concatenated by the + sign.
  1070.       Ex.
  1071.       declare variables
  1072.          x as number : y as number
  1073.       end
  1074.       for employees with taxcode = input.oldtaxcode
  1075.          y = employees.total copies :exit for
  1076.       next
  1077.       for employees with taxcode = input.oldtaxcode
  1078.          x = x + 1
  1079.          display status "Updating Record" + x + "of" + y
  1080.          employees.taxcode = input.newtaxcode
  1081.          update record
  1082.       next
  1083.       The status line is displayed centrally in a small window when
  1084.       the procedure runs. A Status line can have a maximum of 68
  1085.       characters. If you create a status line of more than 68
  1086.       characters then it will be cut short to that length.
  1087.       If you need to display counters in two nested loops then write
  1088.       the full display line in the outer loop and "display status"
  1089.       with no parameters in the inner loop.
  1090.       for customers
  1091.          x = x + 1
  1092.          - loop statements -
  1093.          display status "Checking Invoice" + y + "of customer" + x
  1094.          for invoices with customer = customers.name
  1095.             y = y + 1
  1096.             - Loop Statements -
  1097.             display status
  1098.          next
  1099.       next
  1100.                                 - 36 -
  1101. ................................................................................
  1102.       DO..LOOP             
  1103. PROCEDURE COMMAND   
  1104. DO..LOOP
  1105.       The "Do" loop structure is used in the Easy Base Procedure code
  1106.       to repeat a series of commands or statements. Whenever a
  1107.       procedure reaches a "Do" command it repeats all the statements
  1108.       between the "Do" and the "Loop" statements until the loop is
  1109.       broken by an "Exit Do" command.
  1110.       Ex.
  1111.       The following code fragment prints 10 copies of the top fifty
  1112.       best selling items in a "stock" form.
  1113.       .........................code............................
  1114.       declare output fields
  1115.          stock.item : stock.sales : today
  1116.       end
  1117.       Declare variables
  1118.          copies as number : items as number
  1119.       end
  1120.       today = system date
  1121.       do
  1122.          copies = copies + 1 :items = 0
  1123.          if copies = 11 then exit do
  1124.          bold on
  1125.          print report header
  1126.          bold off
  1127.          for stock with sales in reverse order
  1128.             items = items + 1
  1129.             if items = 51 then exit for
  1130.             print list items
  1131.          next
  1132.          bold on : print report footer : bold off
  1133.          page feed
  1134.       loop
  1135.       ............................format.....................
  1136.       .Report Header
  1137.          
  1138.          Top 50 Best Selling Items               {today field}
  1139.          
  1140.       .list items
  1141.             {stock.item field}        {stock.sales field}
  1142.       .Report Footer
  1143.          
  1144.       .end
  1145.                                 - 37 -
  1146. ................................................................................
  1147.       Erase                
  1148. File Command      
  1149. Erase
  1150.       The "Erase" command erases files. It accepts wildcard
  1151.       parameters.
  1152.       ex.
  1153.       Erase "C:\letters\*.doc"
  1154.       Ex.
  1155.       index off
  1156.       For faxlog with date < system date - 30
  1157.          erase jointext("C:\Fax\",faxlog.filename)
  1158.          delete record
  1159.       next
  1160.                                 - 38 -
  1161. ................................................................................
  1162.       ESCAPE ON/OFF        
  1163. PROCEDURE COMMAND   
  1164. ESCAPE ON/OFF
  1165.       When a procedure is running in Easy Base, it cannot, by
  1166.       default, be interrupted. If your procedure simply lists data to
  1167.       the screen then the end user may not need to see the entire
  1168.       output. You can allow the user to terminate a procedure
  1169.       prematurely with the "Escape On" command.
  1170.       If a procedure performs several tasks, you can selectively
  1171.       enable and disable the Escape Key with the commands "Escape On"
  1172.       and "Escape" Off"
  1173.       Ex.
  1174.       For newpayscales
  1175.          print list items
  1176.       next
  1177.       escape off
  1178.       for newpayscales
  1179.          for employees with scale = newpayscales.scale
  1180.             employees.rate = newpayscales.rate
  1181.             update record
  1182.          next
  1183.       next
  1184.       escape on
  1185.       for employees
  1186.          print newpay
  1187.       next
  1188.       In the above example a procedure lists new pay scales, updates
  1189.       the "Employees" form with the new pay rate and then lists the
  1190.       employees with their new rates.
  1191.       While the procedure is running the operator can terminate it
  1192.       during either of the lists but he cannot terminate it during
  1193.       the process of updating the "Employees" form.
  1194.       See also: Pause On/Off
  1195.                                 - 39 -
  1196. ................................................................................
  1197.       EXIT BATCH MENU      
  1198. PROCEDURE COMMAND   
  1199. EXIT BATCH MENU
  1200.       The "Exit Batch Menu" command terminates a current Batch Menu
  1201.       and returns control to the menu which called it.
  1202.       Ex.
  1203.       An application starts with a batch menu which calls a second
  1204.       batch menu which performs regular daily tasks. It then calls
  1205.       the main user menu. If the application is exited after the
  1206.       daily tasks batch menu has been completed then you will not
  1207.       wish to re-run the daily tasks when the application is
  1208.       restarted on the same day. To prevent this create a form
  1209.       "tasksdone" with a single field "date" and enter a single
  1210.       record with yesterdays date.
  1211.       The first procedure on the daily tasks batch menu would then be
  1212.       for tasksdone
  1213.          if tasksdone.date = system date then
  1214.             exit batch menu
  1215.          else
  1216.             tasksdone.date = system date
  1217.             update record
  1218.          end if
  1219.       next
  1220.                                 - 40 -
  1221. ................................................................................
  1222.       EXIT PROCEDURE       
  1223. PROCEDURE COMMAND   
  1224. EXIT PROCEDURE
  1225.       The "Exit Procedure" command terminates a procedure.
  1226.       Ex.
  1227.       if input.codeword <> "fred" then exit procedure
  1228.       for staffconfidential with name = input.name
  1229.          print list items
  1230.       next
  1231.       If the procedure has a repeating input screen then this is
  1232.       cancelled by the "Exit Procedure" command.
  1233.                                 - 41 -
  1234. ................................................................................
  1235.       File_Date File_Time  
  1236. System value      
  1237. File_Date File_Time
  1238.       Whenever you open a non Easy Base file it's date and time stamp
  1239.       are available in the system values File_Date and File_Time.
  1240.                                 - 42 -
  1241. ................................................................................
  1242.       File_Len             
  1243. System Value      
  1244. File_Len
  1245.       Whenever you open an external file with the "Open" Command the
  1246.       length of the opened file is available in the system value
  1247.       File_Len.
  1248.       The main use of the File_Len value is to position the
  1249.       Read/Write pointer ready to append data to an existing file.
  1250.       ...................
  1251.       declare variables
  1252.          CR as text
  1253.       end
  1254.       CR = jointext(chr$(13),chr$(10))
  1255.       Open "C:\WP\Address.txt"
  1256.       seek File_Len + 1
  1257.       Write Input.name
  1258.       Write CR
  1259.       Write Input.address1
  1260.       Write CR
  1261.       Write Input.address2
  1262.       Write CR
  1263.       Write input.address3
  1264.       Write CR
  1265.       Close
  1266.                                 - 43 -
  1267. ................................................................................
  1268.       File_Pos             
  1269. System Value      
  1270. File_Pos
  1271.       Whenever you open an external file with the "Open" command,
  1272.       The position of the file read/write pointer is available in the
  1273.       system value File_Pos.
  1274.       The value is in bytes counting the first byte as 1.
  1275.       The File_Pos value is used to make relative movements of the
  1276.       Read/write pointer  with the "Seek" command
  1277.       .....................................
  1278.       Open "C:\myfiles\Report.txt"
  1279.       for reports new record
  1280.          Read 10 to reports.CustNo
  1281.          Seek File_pos + 3
  1282.          read 20 to reports.Custname
  1283.       next
  1284.       close
  1285.       ......................................
  1286.       You can move the Read/Write pointer in either direction.
  1287.       Seek File_Pos - 20
  1288.       If you move the pointer back beyond the start of the file Easy
  1289.       Base generates the error message "Seek Value < 1 !".
  1290.       See Also: Open, Close, Seek, Read, Write
  1291.                                 - 44 -
  1292. ................................................................................
  1293.       Find                 
  1294. File Command      
  1295.       The "Find" command is used to select non Easy Base files using
  1296.       a wildcard Spec. When you issue the command Find with a
  1297.       wildspec parameter, Easy Base finds the first file to match the
  1298.       spec and puts its name in the Found_File system value. If you
  1299.       then repeat the command without a spec, Easy Base finds the
  1300.       next matching filename and puts it in Found_File. When all
  1301.       files have been found the Found_File value reverts to "Blank".
  1302.       Example: A company recieves replacement part orders by FAX.
  1303.       After the Address lines the FAX is formatted in four lines
  1304.       "Order Start:" - Engineers ID - Part ID - Quantity.
  1305.       All incoming FAXes for parts are filed in C:\FAX\ORDERS.
  1306.       The following procedure imports the orders to the Orders form
  1307.       and then deletes the FAX files.
  1308.       Declare variables
  1309.          Ln as text
  1310.       end
  1311.       Find "C:\FAX\ORDERS\*.*"
  1312.       Do
  1313.          If Found_File = Blank then exit do
  1314.          For orders new record
  1315.             open jointext("C:\FAX\ORDERS\",Found_File)
  1316.             Do
  1317.                Read line to Ln
  1318.                If Ln = "Order start:" then exit do
  1319.             Loop
  1320.             Read line to orders.engineer
  1321.             Read line to order.part
  1322.             read line to orders.quantity
  1323.          next
  1324.          Close
  1325.          Find
  1326.       Loop
  1327.       Erase "C:\FAX\ORDERS\*.*"
  1328.                                 - 45 -
  1329. ................................................................................
  1330.       FIXED POINT          
  1331. FIELD TYPE       
  1332. FIXED POINT
  1333.       Fixed point fields can display up to 14 digits. They use the
  1334.       comma for thousands separation and the full stop for decimal
  1335.       separation.
  1336.       There are no rounding errors with fixed point fields.
  1337.       See - Operators arithmetic
  1338.                                 - 46 -
  1339. ................................................................................
  1340.       FLOATING POINT       
  1341. FIELD TYPE       
  1342. FLOATING POINT
  1343.       Floating point fields can display up to 14 digits. They do not
  1344.       have a thousands separator. They are left justified.
  1345.                                 - 47 -
  1346. ................................................................................
  1347.       FOR..NEXT            
  1348. PROCEDURE COMMAND   
  1349. FOR..NEXT
  1350.       The "For" command initiates loops which load records from forms
  1351.       for processing. All statements between the "For" and the "Next"
  1352.       commands are repeated for each record selected.
  1353.       Ex.
  1354.       For Videos
  1355.          If Videos.price = 2.00 then Videos.price = 2.50
  1356.          update record
  1357.       next
  1358.       In the above example each record in the "Videos" form is loaded
  1359.       into memory - the price field is checked and if it is 2.00 then
  1360.       it is altered to 2.50 - the record is then updated on disk.
  1361.       "For" loops can be nested to any depth.
  1362.       Ex.
  1363.       for videoprices
  1364.          for videos
  1365.             if videos.price = videoprices.price then
  1366.                print list items
  1367.             end if
  1368.          next
  1369.       next
  1370.       In the above example the outer loop loads each record from the
  1371.       "Videoprices" form.  While each of these is in memory it then
  1372.       loads each record from the "Videos" form, tests to see if the
  1373.       price field in "Videos" is the same as the price field in
  1374.       "Videoprices" and if so prints the list items section of the
  1375.       report format (containing the video title field) thus grouping
  1376.       all video titles by price.
  1377.       If a "For" loop is unqualified as above then every record is
  1378.       processed starting at one and advancing in sequence. "For"
  1379.       loops can be qualified in several ways in order to select
  1380.       records in other orders or groups. The following qualifications
  1381.       are available:-
  1382.       For (form) with (fieldname) in order
  1383.       For (form) with (fieldname) in reverse order
  1384.       For (form) with (fieldname) =  (value)
  1385.       For (form) with (fieldname) >  (value)
  1386.       For (form) with (fieldname) <  (value)
  1387.       For (form) with (fieldname) >= (value)
  1388.       For (form) with (fieldname) <= (value)
  1389.       For (form) new record
  1390.       With the exception of the "New Record" qualification, all
  1391.       accept the suffix "Unique" and an "Alias" for the form name.
  1392.                                 - 48 -
  1393. ................................................................................
  1394.       FOR..NEXT            
  1395. PROCEDURE COMMAND   
  1396. FOR..NEXT
  1397.       If a "For" loop is qualified by "in order" or "in reverse
  1398.       order" then the records are selected in alphabetical or reverse
  1399.       alphabetical order if the selection field is text, and in
  1400.       numeric or reverse numeric order if the selection field is
  1401.       numeric.
  1402.       Ex.
  1403.       for books with title in order
  1404.          print list items
  1405.       next
  1406.       Ex.
  1407.       for salesmen with monthlysales in reverse order
  1408.          print list items
  1409.       next
  1410.       If a "For" loop is qualified by "in order unique" or "in
  1411.       reverse order unique" then records will be selected in order or
  1412.       in reverse order as above. However, where there are multiple
  1413.       occurrence of the same field value a "unique" loop will only
  1414.       select the first occurrence of each value if the loop is in
  1415.       order or the last occurrence if the loop is in reverse order.
  1416.       Ex.
  1417.       for books with category in order unique
  1418.          count = count + 1
  1419.          print list items
  1420.       next
  1421.       print categorycount
  1422.       This example prints and counts the different categories in the
  1423.       "books" form.
  1424.       Ex.
  1425.       for theatreseats with price in reverse order unique
  1426.          for seatprices new record
  1427.             seatprices.price = theatreseats.price
  1428.          next
  1429.       next
  1430.       The above example selects one example only of each seat price
  1431.       in an existing "theatreseats" form in descending price order
  1432.       and enters a new record in the new "seatprices" form.
  1433.                                 - 49 -
  1434. ................................................................................
  1435.       FOR..NEXT            
  1436. PROCEDURE COMMAND   
  1437. FOR..NEXT
  1438.       If a "For" loop is qualified by a "Fieldname = " condition then
  1439.       only the record or records where the field contents match the
  1440.       condition will be selected.
  1441.       Ex.
  1442.       for books with category = "fiction"
  1443.          print list items
  1444.       next
  1445.       This example prints all books which have the category "fiction"
  1446.       Ex.
  1447.       For customers with acno = input.acno
  1448.          creditlimit = input.creditlimit
  1449.          update record
  1450.       next
  1451.       In this example the procedure has an input screen where the
  1452.       operator enters a customers account number and new credit
  1453.       limit. On pressing F2 the procedure finds the single record in
  1454.       the "Customers" form which has the input account number and
  1455.       updates the "creditlimit" field.
  1456.                                 - 50 -
  1457. ................................................................................
  1458.       FOR..NEXT            
  1459. PROCEDURE COMMAND   
  1460. FOR..NEXT
  1461.       If a "For" loop is qualified by a "with (fieldname) > " or
  1462.       "with (fieldname) >= " condition then records are selected in
  1463.       order like the "with (fieldname) in order" qualification but
  1464.       starting with the first record where the field contents match
  1465.       the condition value rather than the first record.
  1466.       Similarly the qualifications "with (fieldname) < " and "with
  1467.       (fieldname) <= " select records in reverse order but starting
  1468.       with the last record to match the condition value.
  1469.       In case you are new to progamming it should be pointed out that
  1470.       the relational operators >, <, >= and <= can be applied to text
  1471.       as well as to numbers. When they are applied to text they
  1472.       relate to the text's alphabetical order.
  1473.       These four qualifications provide the means to select any
  1474.       subset of records which has a range of values in a particular
  1475.       field.
  1476.       Ex.
  1477.       for pupils with age > 6
  1478.          if pupils.age = 12 then exit for
  1479.          print list items
  1480.       next
  1481.       This example prints the names of all pupils between the ages of
  1482.       seven and eleven. The "For" qualification starts selection in
  1483.       numeric order of age starting at seven and the "Exit for"
  1484.       command terminates the loop when the first pupil aged twelve is
  1485.       loaded.
  1486.       Ex.
  1487.       A "Videos" form has a compound index field called "catorder"
  1488.       which is derived by joining the text of the "category" and
  1489.       "title" fields. The following procedure selects all the videos
  1490.       which have the category entered on the input screen and lists
  1491.       them with the title in alphabetic order.
  1492.       for videos with catorder >= input.category
  1493.          if videos.category > input.category then exit for
  1494.          print list items
  1495.       next
  1496.       Ex.
  1497.       for vehicles with seats > 4 unique
  1498.          count = count + 1
  1499.       next
  1500.       "count" returns the number of different seat capacities > 4
  1501.                                 - 51 -
  1502. ................................................................................
  1503.       FOR..NEXT            
  1504. PROCEDURE COMMAND   
  1505. FOR..NEXT
  1506.       If a "For" loop is qualified by "new record" then no records
  1507.       are selected from the form. Instead, a new blank record is
  1508.       created at the "For" command, all statements between the "For"
  1509.       and "Next" commands apply to this new record and it is entered
  1510.       to the form at the "Next" command.
  1511.       Ex.
  1512.       for books new record
  1513.          books.dateinstock = system date
  1514.          copy all from input
  1515.       next
  1516.       This example enters a new record to the "Books" form making the
  1517.       "dateinstock" field equal the system date and copying all other
  1518.       fields from the procedures input screen.
  1519.       Ex.
  1520.       declare variables
  1521.         hourcount as number
  1522.       end
  1523.       '..............clear last wages
  1524.       clear records from wagelist
  1525.       '..........count employees hours from timesheet...
  1526.       for employees
  1527.          hourcount = 0
  1528.          for timesheet with worksno = employees.worksno
  1529.             hourcount = hourcount + timesheet.hours
  1530.          next
  1531.          for wagelist new record
  1532.             wagelist.worksno = employees.worksno
  1533.             wagelist.name = employees.name
  1534.             wagelist.hours = hourcount
  1535.             wagelist.grosswage = employees.wagerate * hourcount
  1536.          next
  1537.       next
  1538.       '.................print the wages list
  1539.       for wagelist with worksno in order
  1540.          print list items
  1541.       next
  1542.       This procedure starts by erasing the present contents of the
  1543.       "wagelist" form. It then selects each record from the
  1544.       "employees" form, counts all entries in the "timesheet" form
  1545.       for the employee and enters a new record in the "wagelist"
  1546.       form. Finally it prints the new wage list.
  1547.                                 - 52 -
  1548. ................................................................................
  1549.       FOR..NEXT            
  1550. PROCEDURE COMMAND   
  1551. FOR..NEXT
  1552.       Occasionally you may need to nest a "For" loop of a form within
  1553.       another "For" loop of the same form. If you do this, then in
  1554.       order to differentiate between the fields in the outer and
  1555.       inner loops you must allocate an "alias" name to the form in
  1556.       one of the loops. When you allocate an alias to a form name
  1557.       then all the fields of the form can also be referenced by the
  1558.       alias name.
  1559.       Ex.
  1560.       .......................procedure code...........
  1561.       declare output fields
  1562.          males : females : pupils.age
  1563.       end
  1564.       for pupils with age in order unique
  1565.          males = 0 : females = 0
  1566.          for pupils alias agegroups with age = pupils.age
  1567.             if agegroups.sex = "male" then
  1568.                males = males + 1
  1569.             else
  1570.                females = females + 1
  1571.             end if
  1572.          next
  1573.          print list items
  1574.       next
  1575.       ....................output format......................
  1576.       .list items
  1577.       There are {males} males and {females} females aged {pupils.age}
  1578.       .end
  1579.       This example counts and prints the number of male and female
  1580.       pupils in each age group.
  1581.                                 - 53 -
  1582. ................................................................................
  1583.       FORMATTED TEXT       
  1584. FIELD TYPE       
  1585. FORMATTED TEXT
  1586.       If you define a field with the type "formatted text" a window
  1587.       opens up in which you enter the formatting characters. The
  1588.       characters which are to be entered by the user are shown as
  1589.       question marks. Any other characters which you enter become
  1590.       permanent fixtures in the field. The "formatted text" field can
  1591.       be up to twenty characters long and can be used for dates,
  1592.       national insurance numbers etc.
  1593.       Formatted text fields should not be derived.
  1594.                                 - 54 -
  1595. ................................................................................
  1596.       Fun_Key              
  1597. SYSTEM VALUE      
  1598. Fun_Key
  1599.       The Fun_Key system value holds the number of the function key
  1600.       which was pressed to run a procedure from its input screen. If
  1601.       the procedure was started automatically by a [Run] field
  1602.       control then Fun_Key returns the value 0.
  1603.       The main use of the Fun_Key value is to branch from one
  1604.       procedure to another using the Run command. Its value is also
  1605.       available immediately to the input screen field derivations.
  1606.       You can therefore make any field entry mandatory or not
  1607.       depending on which function key was pressed.
  1608.       Example.
  1609.       If you set the Mandatory entry attribute of field "Name" to
  1610.       "If" and enter the condition "Fun_Key = 2 or Fun_Key 4" then
  1611.       the procedure cannot be run with the F2 or F4 keys unless the
  1612.       Name field has been filed but it can be run with the name field
  1613.       blank if any of the other function keys were pressed.
  1614.       The value of disabled function keys is also available to input
  1615.       screen derivations. You can use disabled function keys to
  1616.       redirect the cursor:
  1617.       if(Fun_Key = 7,fieldname[cursor size],fieldname)
  1618.       By using disabled function keys to redirect the cursor to
  1619.       fields on a different page you can make a single procedure
  1620.       appear to have more than on input screen for different
  1621.       purposes.
  1622.       See also "Run" "Disable"
  1623.                                 - 55 -
  1624. ................................................................................
  1625.       GLOBAL NUMBER        
  1626. SYSTEM VALUE      
  1627. GLOBAL NUMBER
  1628.       The variables you create in Easy Base procedures are local
  1629.       variables - they cease to exist when the procedure ends. So
  1630.       that you can pass messages between procedures Easy base
  1631.       provides a single global variable "Global Number".  Once you
  1632.       allocate a value to "Global Number" that value remains
  1633.       unchanged (even if your computer has been turned off) until you
  1634.       allocate another value to it. You can of course pass many
  1635.       messages between procedures simply by entering records in forms
  1636.       and re-reading them but using "Global Number" is much quicker.
  1637.       The following example uses "Global Number" to make access to a
  1638.       user menu restricted by password.
  1639.       Two procedures are defined. The first, "getpassword" has a
  1640.       password field on its input screen and the following code:-
  1641.       if input.password = "gingerbread" then
  1642.          global number = 1
  1643.       else
  1644.          global number = 0
  1645.       end if
  1646.       The second procedure "checkpassword" has the following code:-
  1647.       if global number <> 1 then exit batch menu
  1648.       global number = 0
  1649.       The open access menu system has an item for the restricted menu
  1650.       but instead of calling it direct it calls the menu "Password"
  1651.       which is a batch execute menu with the items
  1652.       run procedure ----  getpassword
  1653.       run procedure ----  checkpassword
  1654.       user menu     ----  restricted
  1655.       If the password "gingerbread" has not been entered in the
  1656.       "getpassword" input screen then "checkpassword" will return
  1657.       control to the original menu.
  1658.                                 - 56 -
  1659. ................................................................................
  1660.       GOTO (FIELD) NEXT    
  1661. DERIVATION PREFIX   
  1662. GOTO (FIELD) NEXT
  1663.       In an Easy Base form or procedure input screen the cursor moves
  1664.       from field to field in the default order top left to bottom
  1665.       right when you press the Return key. You can alter this default
  1666.       order by deriving any field with "Goto (fieldname) next". If
  1667.       the field from which you wish to redirect the cursor already
  1668.       has a derivation formula you simply add the "Goto - Next" as a
  1669.       prefix.
  1670.       Ex.
  1671.       goto price next
  1672.       goto item next default(lookup(stock,name))
  1673.       Cursor redirection with the "Goto - next" derivation only
  1674.       occurs when the Return key is pressed it is not activated if
  1675.       you move the cursor with the directional arrow keys.
  1676.       1. You can have more than one prefix on any one field
  1677.          derivation provided there is a space between each.
  1678.                                 - 57 -
  1679. ................................................................................
  1680.       Help                 
  1681. DERIVATION PREFIX   
  1682.       Easy Base provides a default help line for all data entry and
  1683.       procedure input screens. You can replace the system default
  1684.       help line with your own default help line by pressing F6 during
  1685.       form or screen design.
  1686.       You can also override the default with a field specific help
  1687.       line by using the derivation prefix "Help" followed by the help
  1688.       line in quotation marks.
  1689.       Field specific help lines replace the default help line
  1690.       whenever the cursor is in the field with the derivation prefix.
  1691.       Example: If, in the derivation formula for field "Name" you
  1692.       type:-
  1693.       Help "Enter Customers name and press return"
  1694.       then the help line will show the quoted text whenever the
  1695.       cursor is in the Name field but will revert to the default when
  1696.       the cursor moves to another field.
  1697.       You can use the Help prefix in any or all fields.
  1698.       The help line has a maximum length of 80 characters. If you
  1699.       quote a help line greater than 80 characters it will be
  1700.       truncated at run time. Help lines of less than 80 characters
  1701.       are automatically padded to 80 with space characters.
  1702.       If the field already has a derivation formula, add the help as
  1703.       a prefix:-
  1704.       Help "Enter Part Name" proper(partname)
  1705.       Notes:
  1706.       1.  There must be a space between Help and the quoted line.
  1707.       2.  The line must be in quotes and quotation marks cannot be
  1708.           included in the line.
  1709.       3.  You can have more than one prefix on any one field
  1710.           derivation provided there is a space between each.
  1711.       Ex.
  1712.       Autodial Help "Press Ctrl + D to Dial" lookup(customers,No)
  1713.                                 - 58 -
  1714. ................................................................................
  1715.       HOURS                
  1716. FUNCTION        
  1717. HOURS
  1718.       This function returns the hour ( 1 to 23) of the time parameter
  1719.       Ex.  Hour(system time)
  1720.       Ex.
  1721.       Labourcharge = (hours(endtime)-hours(starttime))* rate
  1722.       Acceptable parameters:
  1723.       System time
  1724.       Time field
  1725.       Maketime function
  1726.       Time expression
  1727.                                 - 59 -
  1728. ................................................................................
  1729.       IF                   
  1730. FUNCTION        
  1731.       Ex.  if(num >= 0,"Positive","negative")
  1732.       The first parameter of the "if" function is an expression, the
  1733.       second is the value to be returned if the expression is true
  1734.       and the third is the value to be returned if the expression is
  1735.       false.
  1736.       If the third parameter is omitted and the expression is false
  1737.       then the field or variable retains any value it had before the
  1738.       function was called.
  1739.       The "if" function can be extended to a full "case" function
  1740.       simply by adding more expressions and return values.
  1741.       Ex.  if(num > 0,"Positive",num = 0,"Zero","Negative")
  1742.       There is no limit to the number of expressions and return
  1743.       values. If more than one expression is true the value returned
  1744.       is that for the first true expression. If none are true then
  1745.       the trailing value is returned as the "case else".
  1746.       Acceptable Parameters:
  1747.       Numeric expressions
  1748.       Quoted text
  1749.       Fields and variables
  1750.       Other nested functions
  1751.       System Values
  1752.                                 - 60 -
  1753. ................................................................................
  1754.       IF THEN ELSE         
  1755. PROCEDURE COMMAND   
  1756. IF THEN ELSE
  1757.       Easy Base recognizes the following "If Then Else"
  1758.       constructions.
  1759.       1.    if (condition) then (action)
  1760.             ------------------------------------------
  1761.       2.    if (condition) then (action) else (action)
  1762.             ------------------------------------------
  1763.       3.    if (condition) then
  1764.                (action)
  1765.                (action)
  1766.                (action)
  1767.             end if
  1768.             -----------------------------------------
  1769.       4.    if (condition) then
  1770.                (action)
  1771.                (action)
  1772.             else
  1773.                (action)
  1774.                (action)
  1775.             end if
  1776.       If then constructions can be nested to any depth.
  1777.       if (condition) and (condition) then
  1778.          (action)
  1779.          if (condition) or (condition) then
  1780.             (action)
  1781.             (action)
  1782.          else
  1783.             (action)
  1784.             if (condition) eqv (condition) then (action)
  1785.             (action)
  1786.          end if
  1787.          if (condition) then (action)
  1788.       else
  1789.          (action)
  1790.       end if
  1791.       Easy base does not interpret "Else if" constructions.
  1792.       Easy base does not interpret two "if" conditions on one line.
  1793.       In the above examples "action" applies to any Easy base command
  1794.       or full "Do Loop" or full "For Next" structure.
  1795.       You cannot split a "Do Loop" structure and you can only split a
  1796.       "For Next" structure by a simple "If then" and "End if" with no
  1797.       "else" command.
  1798.       Ex. on next page.
  1799.                                 - 61 -
  1800. ................................................................................
  1801.       IF THEN ELSE         
  1802. PROCEDURE COMMAND   
  1803. IF THEN ELSE
  1804.       In the following example the procedure has an input screen with
  1805.       a field "type". "type" is a choice field with the choices "In
  1806.       age order", "In alphabetic order" and "By sex". The procedure
  1807.       code selects one of three listings from the "Pupils" form by
  1808.       splitting "For Next" structures by "If Then" structures.
  1809.       if input.type = "in age order" then
  1810.          for pupils with age in order
  1811.       end if
  1812.       if input.type = "in alphabetic order" then
  1813.          for pupils with name in order
  1814.       end if
  1815.       if input.type = "by sex" then
  1816.          for pupils with sex in order
  1817.       end if
  1818.          print list items
  1819.       next
  1820.       next
  1821.       next
  1822.       The structure above is the only one in which "For Next"
  1823.       structures can be split. There must be a separate "If Then"
  1824.       followed by "End If" for each "For". There must be a "Next for
  1825.       each "For"  and there cannot be an "Else" anywhere in the
  1826.       construction.
  1827.                                 - 62 -
  1828. ................................................................................
  1829.       INDEX OFF            
  1830. PROCEDURE COMMAND   
  1831. INDEX OFF
  1832.       When an Easy Base procedure adds, updates or deletes a record
  1833.       then by default it updates any affected index files. As the
  1834.       majority of transaction procedures act on a single record this
  1835.       is the fastest method of processing. It does of course require
  1836.       that the form is periodically re-packed.  If, however, a
  1837.       procedure is to add, update or delete many records then
  1838.       updating each affected index file on each iteration of the
  1839.       "For" loop can be much slower than ignoring the indices during
  1840.       the loop and re-writing them from scratch afterward.
  1841.       You can take the "re-write" option by issuing the command
  1842.       "Index off" before the "For" loop.
  1843.       index off
  1844.       for employees
  1845.         for wagelist new record
  1846.            wagelist.worksno = employees.worksno
  1847.            wagelist.taxcode = employees.taxcode
  1848.         next
  1849.       next
  1850.       Obviously re-writing an entire index file when only one or two
  1851.       records are affected would be slower than simply updating the
  1852.       indices. The actual point at which "Index Off" becomes faster
  1853.       can only be determined by trial but as a general rule the two
  1854.       systems take equal time when between 12 and 15 percent of the
  1855.       records of a file are affected and the advantage of "Index Off"
  1856.       becomes greater the bigger this percentage.
  1857.       There is no corresponding "Index On" command. Indexing is
  1858.       turned back on automatically and the index files are re-written
  1859.       at the end of the loop to which the command applies. If you
  1860.       require indexing off during more than one loop you must issue
  1861.       the command before each.
  1862.       index off
  1863.       for invoices with date < makedate(05,04,93)
  1864.          delete records
  1865.       next
  1866.       index off
  1867.       for invoices with customer = "john smith"
  1868.          invoices.customer = "John Smith Ltd"
  1869.          update record
  1870.       next
  1871.       If you prefix a loop which deletes records from a form then the
  1872.       form is packed at the end of the loop.
  1873.                                 - 63 -
  1874. ................................................................................
  1875.       INSTALL FORM         
  1876. UTILITY         
  1877. INSTALL FORM
  1878.       The "Install Form" utility is accessed from the Utilities menu.
  1879.       If you wish to include a form in one application which you
  1880.       designed in another then you cannot simply copy the files to
  1881.       the new applications directory as there will be no entry in the
  1882.       "Forms Directory" file.
  1883.       To install a form from another application - first get the
  1884.       forms DOS filename from that application then select "Install
  1885.       Form" from the utilities menu. You will be asked to supply the
  1886.       forms name and the full path and filename from where it is to
  1887.       be copied. Easy Base will then copy the forms definition file
  1888.       and make the appropriate entry in the "Forms Directory". It
  1889.       will then ask whether or not you wish the data to be copied
  1890.       from the original application.
  1891.       If you install a form from another application and it has
  1892.       "lookup" derivations or Choice List fields then you will have
  1893.       to create the relationships and choice lists in the new
  1894.       application. They are not automatically reproduced.
  1895.                                 - 64 -
  1896. ................................................................................
  1897.       INSTALL PRINTER      
  1898. UTILITY         
  1899. INSTALL PRINTER
  1900.       The "Install printer" utility is accessed from the Utilities
  1901.       menu. It can also be included in a user menu so that end users
  1902.       of finished applications can install their printer without
  1903.       access to the system menus.
  1904.       When you select "Install Printer" you are offered a choice of
  1905.       ten printer drivers - five for named printers and five generic
  1906.       drivers. The drivers supplied cover virtually all printers
  1907.       except daisy wheels.
  1908.       When you have chosen your printer driver Easy Base then asks
  1909.       for the parallel port number to which printer output is to be
  1910.       sent - one or two. Easy Base does not have a built in serial
  1911.       port printer output. If your printer only has a serial input
  1912.       then you must redirect a parallel port with the DOS "Mode"
  1913.       command.
  1914.       Easy Base then asks how much paper wastage there is at the top
  1915.       of the page. This is quite important as it is used in
  1916.       conjunction with the paper size in use to determine the
  1917.       "Bottom Margin" value, used for pagination in printed reports.
  1918.       You are then asked for the wastage at the left margin. This
  1919.       information is used in the format editor to display the right
  1920.       edge of the paper at the different print sizes. There are only
  1921.       two settings for wastage at the left margin - zero and 
  1922.  inch.
  1923.       If you have a cartridge fed printer such as a Laser or Bubble
  1924.       Jet then it will almost certainly be 
  1925.  inch. If you have a
  1926.       traction or manual feed then you will be able to adjust the
  1927.       left margin and you should set it to zero.
  1928.       Finally you are asked for the top margin required in printed
  1929.       reports. This can only be between the value set as the printers
  1930.       inherent wastage and one inch.  The value you set here will be
  1931.       the default top margin for all printouts. If you need a larger
  1932.       top margin for certain printouts then you must include blank
  1933.       lines in the page header of the procedures output format.
  1934.                                 - 65 -
  1935. ................................................................................
  1936.       INSTALL PROCEDURE    
  1937. UTILITY         
  1938. INSTALL PROCEDURE
  1939.       The "Install procedure" utility is accessed from the
  1940.       Utilities menu and allows you to install procedures which you
  1941.       designed in another application. It is used exactly like the
  1942.       "Install Form" utility previously described.
  1943.                                 - 66 -
  1944. ................................................................................
  1945.       INTEGER              
  1946. FIELD TYPE       
  1947. INTEGER
  1948.       Integer fields can have up to 14 digits and use a comma as the
  1949.       thousands separator.
  1950.       Although integer fields display integers they store the result
  1951.       of any division correct to 15 significant figures.
  1952.       See - Operators Arithmetic
  1953.                                 - 67 -
  1954. ................................................................................
  1955.       INTEXT               
  1956. FUNCTION        
  1957. INTEXT
  1958.       This function returns the starting character number of one
  1959.       length of text within another.
  1960.       Ex.    Intext(companyname," and ")
  1961.              < Returns 7 if companyname = "Turner and Smith"
  1962.       The intext function returns 0 if the second parameter is not
  1963.       found in the first.
  1964.       Ex.
  1965.       If intext(customers.companyname," Ltd") <> 0 then
  1966.          customers.Ltd  = "yes"
  1967.          update record
  1968.       end if
  1969.       Acceptable parameters:
  1970.       Text field/variable
  1971.       Any function returning a text value
  1972.                                 - 68 -
  1973. ................................................................................
  1974.       JOINTEXT             
  1975. FUNCTION        
  1976. JOINTEXT
  1977.       Ex.  Jointext(forename,surname)
  1978.       The jointext function takes any number of parameters.
  1979.       Ex.  Jointext("Mr ",forename," ",surname," Esq.")
  1980.       Ex.  Jointext(if(sex=male,"Mr ","Ms "),surname)
  1981.       The "jointext" function will also perform any arithmetic
  1982.       operations required for a text output.
  1983.       Ex. Jointext("The Gross price is ",netprice *120/100)
  1984.       The "jointext" function is also used for creating compound
  1985.       index fields.
  1986.       Ex. Jointext(reverse(zeropad(price,4,2)),stockitem)
  1987.       This creates a field whose index allows a stock file to be
  1988.       listed with stockitem in alphabetical order but grouped by
  1989.       price in reverse order.
  1990.       If you "Jointext" a date or time field you will get the date or
  1991.       time's numeric value not the date or time's string
  1992.       representation. (See Compound Index)
  1993.       By default the "Jointext" function strips trailing blank space
  1994.       characters from the texts being joined. If you wish to join
  1995.       text in a Text Block field so that the second text starts on a
  1996.       new line then you can force this by including Chr$(13) which
  1997.       Easy base uses as a "New Line" flag.
  1998.       Ex.
  1999.           Jointext(block1,chr$(13),block2)
  2000.           <The text from block2 will start on a new line>
  2001.       Ex.
  2002.           Jointext(block1,chr$(13),chr$(13),block2)
  2003.          <There will be a blank line between block1 and block2>
  2004.       Acceptable Parameters:
  2005.       Numeric expressions
  2006.       Quoted text
  2007.       Fields and variables
  2008.       Other nested functions
  2009.       System Values
  2010.                                 - 69 -
  2011. ................................................................................
  2012.       LEFTTEXT             
  2013. FUNCTION        
  2014. LEFTTEXT
  2015.       This function returns a specified number of characters from the
  2016.       start of a field or variable.
  2017.       Ex.   Lefttext(salutation,2)
  2018.             < returns "Mr" from "Mr Smith" or "Ms" from "Ms Smith"
  2019.       Ex.   Lefttext(datetext(system date),4)
  2020.             < Returns 12th , 20th Etc.>   (European date format)
  2021.       Acceptable parameters:
  2022.       Text field/variable
  2023.       Any function returning a text value
  2024.                                 - 70 -
  2025. ................................................................................
  2026.       LENGTHTEXT           
  2027. FUNCTION        
  2028. LENGTHTEXT
  2029.       This function returns the length of text in a field or variable
  2030.       Ex.   lengthtext(name)
  2031.             < Returns 4 if name = "Bill"  10 if name = "Bill Smith"
  2032.       Acceptable parameters:
  2033.       Text field/variable
  2034.       Any function returning a text value
  2035.                                 - 71 -
  2036. ................................................................................
  2037.       LIST FILE NAMES      
  2038. UTILITY         
  2039. LIST FILE NAMES
  2040.       When you give a name to a Form or Procedure in Easy Base it is
  2041.       not the actual DOS file name used. A Form has separate DOS
  2042.       files for its definition, its data and its indices. Similarly a
  2043.       procedure can have one or two files depending on whether or not
  2044.       it has an input screen. Within an application you never need to
  2045.       know the DOS filenames as Easy Base takes care of all disk
  2046.       activity in the background.
  2047.       You may however need to know the DOS filenames if you intend to
  2048.       export data to another program or copy a Form or Procedure from
  2049.       one application to another.
  2050.       You can list the DOS filenames for Forms and reports with the
  2051.       "List File Names" utility.
  2052.       The "List File Names" utility can also be called from a user
  2053.       menu without accessing the system.
  2054.                                 - 72 -
  2055. ................................................................................
  2056.       LIST VARIABLES       
  2057. PROCEDURE COMMAND   
  2058. LIST VARIABLES
  2059.       The "List Variables" command is a de-bugging facility for
  2060.       developers. If a procedure is not producing the expected
  2061.       results you can interrupt it at any point and view the contents
  2062.       of all fields and variables in memory at that point.
  2063.       Ex.
  2064.       for authors with surname in order
  2065.          if authors.surname = "kippling" then list variables
  2066.          for books with author = authors.surname
  2067.             print list items
  2068.          next
  2069.       next
  2070.                                 - 73 -
  2071. ................................................................................
  2072.       Lock / Unlock        
  2073. Procedure Command   
  2074. Lock / Unlock
  2075.       Network versions only
  2076.       Easy Base automatically places protective locks whenever any
  2077.       process might cause a multiple access confliction. You do not
  2078.       have to use the Lock and Unlock commands to avoid such
  2079.       conflicts.
  2080.       There will however be occasions where multiple access would
  2081.       prevent the correct execution of an application even though no
  2082.       access conflict would occur.
  2083.       For Example, if a procedure collects statistics from form a and
  2084.       form b then updates form c with the information, you might not
  2085.       wish to have any other workstation access form c until the
  2086.       update is complete. Easy Base would not automatically prevent
  2087.       access to form c while your procedure read from a and b as this
  2088.       would not cause any access conflicts.
  2089.       To prevent access in such cases use the Lock and Unlock
  2090.       Commands.
  2091.       Declare variables
  2092.          Count as number
  2093.       end
  2094.       Lock Stats : Lock Stock
  2095.       for Stock with Location = input.location
  2096.          delete record
  2097.       next
  2098.       Pack Stock
  2099.       Unlock Stock
  2100.       For stock
  2101.          count = stock.total records
  2102.          exit for
  2103.       next
  2104.       for stats
  2105.          stats.stockitems = count
  2106.          update record
  2107.       next
  2108.       Unlock stats
  2109.       Locks placed with the Lock command are total locks. There is no
  2110.       option to place read only locking. Once a lock command has been
  2111.       executed it remains in force until the same workstation issues
  2112.       an unlock command for the form. If you need a form to remain
  2113.       locked between procedures you can issue the Lock command in one
  2114.       procedure and the Unlock command in another. In such cases you
  2115.       need to ensure that there is no way to avoid running the
  2116.       procedure with the Unlock command.
  2117.       Similarly, when the Lock and Unlock commands are within a
  2118.       single procedure, there must not be any option to exit the
  2119.       procedure between the two commands.
  2120.                                 - 74 -
  2121. ................................................................................
  2122.       LOOKUP               
  2123. FUNCTION        
  2124. LOOKUP
  2125.       Ex. Lookup(customers,surname)
  2126.           Lookup(customers,surname,address)
  2127.       The first parameter is the name of a relationship defined in
  2128.       the relationships form. The second parameter is the name of the
  2129.       field in the secondary file whose value is to be looked up. The
  2130.       third parameter, which is optional, specifies that a field
  2131.       other than the looked up field is to be listed for selection
  2132.       when there is more than one match. (The looked up field must be
  2133.       indexed)
  2134.       The parameters are absolute. You cannot supply them as
  2135.       variables, fields or the results of other functions.
  2136.       In the first example, if you enter "Sm*" in the field with the
  2137.       derivation and there are several names beginning with Sm, then
  2138.       the names will be listed for you to choose from. This is most
  2139.       useful if all the names are different. If, however, there are
  2140.       several names beginning with Sm but they are all "Smith" then
  2141.       it will be more useful to use the second example which will
  2142.       list all the addresses for the "Smith" names.
  2143.       Lookup functions which have two parameters do not list
  2144.       duplicates when there is more than one match, whereas lookup
  2145.       functions with three parameters do. You can therefore use one
  2146.       lookup of the first type and one lookup of the second type to
  2147.       resolve ambiguities.
  2148.       For example, to perform lookups from the customers form (which
  2149.       has duplicates in the "Surname" field), you would firstly
  2150.       create an additional invisible field on the input screen
  2151.       (surname2) derived surname. You then enter two relationships
  2152.       between the screen and the customers form. The first, called
  2153.       customers, links surname with surname and the second, called
  2154.       customers2, links surname2 with surname.
  2155.       The surname field on the input screen is derived -
  2156.       Lookup(customers,surname). All the other fields to be looked up
  2157.       are derived - Lookup(customers2,fieldname) but one of them (Any
  2158.       one) has the third parameter added :-
  2159.       Lookup(customers2,forename,address)
  2160.       When you enter "Sm" in the surname field, the first lookup will
  2161.       list all the customer surnames beginning with "Sm". When you
  2162.       choose "Smith" from this list, "Smith" will be copied to the
  2163.       invisible field Surname2 and the second lookup will trigger
  2164.       listing all the addresses of the Smith customers.
  2165.                                 - 75 -
  2166. ................................................................................
  2167.       LOWER                
  2168. FUNCTION        
  2169. LOWER
  2170.       Returns the lower case of the parameter.
  2171.       Ex. lower(partname)
  2172.       Ex.
  2173.       Heading = Jointext("List of parts supplied by ",lower(makers.
  2174.       name))
  2175.       Acceptable parameters:
  2176.       Quoted text
  2177.       Text Field/variable
  2178.                                 - 76 -
  2179. ................................................................................
  2180.       MAKEDATE             
  2181. FUNCTION        
  2182. MAKEDATE
  2183.       The Easy base Date field is a six digit field which covers the
  2184.       century from 1 Jan 1981 to 31 Dec 2080 and upon which you can
  2185.       perform addition and subtraction operations in days.
  2186.       Ex. Duedate = Invoicedate + 30
  2187.       In order to provide this facility the date is held as a numeric
  2188.       value. You can only type a date directly into a date field.
  2189.       If you need to enter a date in a derivation or in a procedure
  2190.       code you must use the "makedate" function.
  2191.       Ex.  Makedate(5,11,95)
  2192.           < Returns 05/11/95 >
  2193.       Ex.  Nextmonth = month(system date)+1
  2194.            if nextmonth = 13 then nextmonth = 1
  2195.            Nextdelivery = makedate(1,nextmonth,year(system date))
  2196.            < Returns the date of the first of next month >
  2197.       Acceptable parameters
  2198.       Numeric value
  2199.       Numeric expression
  2200.       Numeric field/variable
  2201.       Any other function which returns a numeric value
  2202.                                 - 77 -
  2203. ................................................................................
  2204.       MAKETIME             
  2205. FUNCTION        
  2206. MAKETIME
  2207.       The value of a time field in Easy base is held as a numeric
  2208.       value representing the number of seconds past midnight. This
  2209.       allows you to perform addition and subtraction operations in
  2210.       seconds.
  2211.       Ex. Timetaken = Round(Endtime - Starttime / 60)
  2212.           < This returns the time taken in minutes >
  2213.       You can only enter a time directly into a time field.
  2214.       If you need to enter a time in a field derivation or in a
  2215.       procedure code you must use the "Maketime" function.
  2216.       Ex. Time = Maketime(20,20,00)
  2217.            <  returns 20:20:00  >
  2218.       Acceptable parameters:
  2219.       Numeric value
  2220.       Numeric expression
  2221.       Numeric field/variable
  2222.       Any other function which returns a numeric value
  2223.                                 - 78 -
  2224. ................................................................................
  2225.       Manual Feed          
  2226. Procedure Command   
  2227. Manual Feed
  2228.       When you set the paper type in use from the utilities menu, you
  2229.       tell Easy Base whether you have a manual or continuous feed
  2230.       printer. This is then used throughout all procedures.
  2231.       If your printer has a continuous feed but a particular
  2232.       procedure requires manual eg label or envelope printing you can
  2233.       force Easy Base to pause after each page without changing the
  2234.       default by issuing the Manual Feed command within the procedure
  2235.       code.
  2236.       Declare output fields
  2237.          mail.name :mail.address
  2238.       end
  2239.       manual feed
  2240.       for mail
  2241.          print envelope
  2242.       next
  2243.                                 - 79 -
  2244. ................................................................................
  2245.       MATHS                
  2246. FUNCTION        
  2247. MATHS
  2248.       The following maths functions can be used anywhere in Easy Base
  2249.       code or field derivations.
  2250.       Log()
  2251.       Log10()
  2252.       Sqrt()
  2253.       Sin()
  2254.       Cos()
  2255.       Tan()
  2256.       Atan()
  2257.       Deg_rad()     converts degrees to radians
  2258.       Rad_deg()     converts radians to degrees
  2259.       Exp()         Raises e (the base of natural logarithms) to the
  2260.                     power of the parameter
  2261.       Acceptable parameters:
  2262.       Numeric value
  2263.       Numeric expression
  2264.       Numeric field/variable
  2265.       Any function returning a numeric value
  2266.                                 - 80 -
  2267. ................................................................................
  2268.       MENU CALLS           
  2269. MENU FUNCTION     
  2270. MENU CALLS
  2271.       In addition to the utilities which can be called from user
  2272.       menus the following calls can also be made.
  2273.       Run Procedure        :   Runs a pre-defined procedure
  2274.       Last Output          :   Recalls the output from a procedure
  2275.       Data Entry           :   Allows direct access to a form
  2276.       User Menu            :   Calls another user menu
  2277.       System Menus         :   Calls the Easy Base System menus
  2278.       Exit to DOS          :   Terminates Easy Base
  2279.       Run external program : Shells to another program
  2280.       Notes:
  2281.       You cannot run another major program from within Easy Base -
  2282.       there is very little spare memory - this call is however useful
  2283.       for calling batch files which export data to other programs for
  2284.       later use.
  2285.       If you place "Exit to DOS" on a normal menu the user will be
  2286.       asked to confirm that he wishes to exit. If you place it on a
  2287.       batch execute menu he will not.
  2288.                                 - 81 -
  2289. ................................................................................
  2290.       MIDTEXT              
  2291. FUNCTION        
  2292. MIDTEXT
  2293.       This function returns a given number of characters from a given
  2294.       starting point in a field or variable.
  2295.       Ex.   Midtext(fileref,4,4)
  2296.             < Returns "Bill" from "TR/Bill/1243"
  2297.       Acceptable parameters:
  2298.       Text field/variable
  2299.       Any function returning a text value
  2300.                                 - 82 -
  2301. ................................................................................
  2302.       MINUTES              
  2303. FUNCTION        
  2304. MINUTES
  2305.       This function returns the minutes number from the time field
  2306.       parameter.
  2307.       Ex.    minutes(system time)
  2308.       Ex.
  2309.       Unitsperhour = rounddown(60/(minutes(endtime)-
  2310.       minutes(starttime)))
  2311.       Acceptable parameters:
  2312.       System time
  2313.       Time field
  2314.       Maketime function
  2315.       Time expression
  2316.                                 - 83 -
  2317. ................................................................................
  2318.       MOD                  
  2319. FUNCTION        
  2320.       The Mod function returns the remainder of an integer division
  2321.       Ex. surplus rounds = mod(bullets,soldiers * ammoissue)
  2322.       Ex.
  2323.       for Historydates
  2324.          historydates.leapyear = "No"
  2325.          if mod(historydates.year,4) = 0 then
  2326.             historydates.leapyear = "Yes"
  2327.             update record
  2328.          end if
  2329.       next
  2330.       < This example fills a new field "leapyear" which has been
  2331.       added to the "Historydates" form after data has been entered>
  2332.       Acceptable parameters:
  2333.       Numeric value
  2334.       Numeric expression
  2335.       Numeric field/variable
  2336.       Any other function which returns a numeric value
  2337.                                 - 84 -
  2338. ................................................................................
  2339.       MONTH                
  2340. FUNCTION        
  2341. MONTH
  2342.       This function returns the month number from a date parameter.
  2343.       Ex.    Month(system date)
  2344.       Ex.    Month(birthdate)
  2345.       Acceptable parameters
  2346.       System date
  2347.       Date field
  2348.       Makedate function
  2349.       Date expression
  2350.                                 - 85 -
  2351. ................................................................................
  2352.       MULTIPLE LINES       
  2353. PROCEDURE COMMAND   
  2354. MULTIPLE LINES
  2355.       You can place multiple code instructions on a single line of
  2356.       the code editor by separating them with a colon.
  2357.       Ex.
  2358.       for ledger with lineno = input.lineno
  2359.          ledger.net = input.net:ledger.vat = input.vat
  2360.          ledger.acno = input.acno:ledger.gross = input.gross
  2361.          update record
  2362.       next
  2363.                                 - 86 -
  2364. ................................................................................
  2365.       Next Batch           
  2366. Procedure Command   
  2367. Next Batch
  2368.       The Next Batch command resets the batch menu pointer from
  2369.       within a procedure. By using the Next Batch command you can
  2370.       cause a batch of procedures to repeat without returning to the
  2371.       menu in the same way that you can repeat a single procedure
  2372.       with an input screen.
  2373.       For example, in a variable length invoicing system you might
  2374.       have three procedures on a batch menu. The first procedure
  2375.       selects the current customer and invoice number, the second
  2376.       writes invoice lines to the lineitems form and the third prints
  2377.       the invoice. To have the entire process repeated after each
  2378.       invoice the last line of the last procedure should be:
  2379.       Next Batch 1
  2380.       Similarly, if the user inadvertently selects the wrong customer
  2381.       in the first procedure you can use an input screen field in the
  2382.       second to return to the first.
  2383.       If input.reselect = "yes" then Next Batch 1
  2384.       By using Next Batch and Global Number you can create a batch
  2385.       menu which reacts like a single procedure repeating until the
  2386.       Escape key is pressed.
  2387.       To exit from a batch of procedures on the escape key, set
  2388.       Global Number to 1 in the first procedure and to 0 in the last.
  2389.       Add a procedure immediately after the first with the code:-
  2390.       If Global Number = 0 then exit batch menu
  2391.                                 - 87 -
  2392. ................................................................................
  2393.       ODD/EVEN PAGE PRINT  
  2394. PROCEDURE COMMAND   
  2395. ODD/EVEN PAGE PRINT
  2396.       If you want to print procedure output on both sides of the
  2397.       paper then, unless you have a VERY expensive printer, the only
  2398.       way to achieve this is to print the odd pages, turn your paper
  2399.       over and print the even pages.  For a short report you can do
  2400.       this by setting paper feed to "Manual" from the utilities menu
  2401.       and turning each sheet over individually. If, however, you have
  2402.       a cut sheet feeder or a cartridge fed printer it is much
  2403.       quicker to print all the odd pages, turn them all over and then
  2404.       print all the even pages.
  2405.       To do this in Easy Base, issue the command "Odd Page Print"
  2406.       immediately before the print output and "Even Page Print"
  2407.       immediately after it.
  2408.       declare output fields
  2409.          customers.name : customers.phone
  2410.       end
  2411.       odd page print
  2412.       for customers with surname in order
  2413.          if bottom margin < .75 then page feed
  2414.          print list items
  2415.       next
  2416.       even page print    '(Easy Base pauses here till you are ready)
  2417.       If you will be binding your printed report down the left hand
  2418.       edge then you will need a larger left margin on the odd pages
  2419.       than on the even. If you start odd page printing with the
  2420.       command "Odd Page Print for Binding" then Easy Base will add
  2421.       half an inch to the format left margin when it prints the odd
  2422.       pages. You cannot alter the fixed value of half an inch but if
  2423.       you create your output format with a left margin of half an
  2424.       inch(suitable for the even pages) and print for binding, you
  2425.       will find that the resulting output suits most office binding
  2426.       systems.
  2427.       If you use Odd/Even page printing then it is important that you
  2428.       realize it is achieved by running the portion of your procedure
  2429.       between the "Odd Page Print" and "Even Page Print" twice -
  2430.       simply cancelling output to the printer at the appropriate
  2431.       times.  You must not, therefore include any commands which add,
  2432.       update or delete records between the commands. If you do they
  2433.       will be performed twice. Similarly if you are running a loop
  2434.       counter during the print process then it will have double the
  2435.       expected value after the "Even Page Print" command.
  2436.       The system value "Page Number" is reset to one at the "Even
  2437.       Page Print" command. If you include two separate sets of odd
  2438.       and even printing in a single procedure then you cannot use
  2439.       "Page Number" to number the second printout. You can of course
  2440.       use an ad hoc field. Just remember to reset it to one
  2441.       immediately before the "Even Page Print" command.
  2442.                                 - 88 -
  2443. ................................................................................
  2444.       ODD/EVEN PAGE PRINT  
  2445. PROCEDURE COMMAND   
  2446. ODD/EVEN PAGE PRINT
  2447.       This document was written in an Easy Base form "Ref" which has
  2448.       fields "Name", "Type", "Pageno" "Topicpage" and three text
  2449.       block fields "T1", "T2" and "T3". Each record holds one page of
  2450.       the reference manual and the pages were entered in no
  2451.       particular order. The following procedure was used to number,
  2452.       sort, index and print the manual.
  2453.       declare output fields
  2454.          ref.name : ref.type :ref.pageno
  2455.          ref.t1 : ref.t2 : ref.t3 : type : name
  2456.       end
  2457.       declare variables
  2458.          x as number : y as number
  2459.          namelen as number : typelen as number
  2460.       end
  2461.       '.....................NUMBER REFERENCE PAGES....
  2462.       for ref with name in order
  2463.          y = ref.total records
  2464.          x = x + 1
  2465.          display status "Numbering page" + x + "of" + y
  2466.          ref.pageno = x : update record
  2467.       next
  2468.       odd page print for binding
  2469.       '...............PRINT COMMANDS INDEX........
  2470.       bold on : print commandheader : bold off
  2471.       for ref with type = "procedure command"
  2472.          subindex name
  2473.       next
  2474.       for ref with subindex in order
  2475.          if topicpage > 1 then skiprec  'only first page
  2476.          ref.name = proper(ref.name)    'of each topic listed
  2477.          print commands
  2478.       next
  2479.       '..............PRINT SYSTEM VALUES INDEX...
  2480.       bold on : print valuesheader : bold off
  2481.       for ref with type = "system value"
  2482.          subindex name
  2483.       next
  2484.       for ref with subindex in order
  2485.          if topicpage > 1  then skiprec
  2486.          ref.name = proper(ref.name)
  2487.          print values
  2488.       next
  2489.       page feed       '... eject first index page
  2490.       '......... subsequent index pages are produced with exactly
  2491.       '........ the sane code as above and are omitted for clarity.
  2492.       '......................MAIN REFERENCE.............
  2493.       page feed
  2494.       for ref with name in order
  2495.          namelen = lengthtext(ref.name)
  2496.                                 - 89 -
  2497. ................................................................................
  2498.       ODD/EVEN PAGE PRINT  
  2499. PROCEDURE COMMAND   
  2500. ODD/EVEN PAGE PRINT
  2501.          typelen = lengthtext(ref.type)
  2502.          '....centre justify type
  2503.          type = jointext(stringof((20-typelen)/2,chr$(255)),ref.type)
  2504.          '....right justify name
  2505.          name = jointext(stringof(20-namelen,chr$(255)),ref.name)
  2506.          bold on : print refheader : bold off  'type and names fields
  2507.          print list items                      't1, t2, t3
  2508.          bold on print reffoot                 'pageno
  2509.          page feed
  2510.       next
  2511.       even page print
  2512.                                 - 90 -
  2513. ................................................................................
  2514.       Open                 
  2515. File Command      
  2516.       The "Open" command is used to open a non-Easy Base file.
  2517.       The filename can be supplied within quotes or as a text
  2518.       variable or field.
  2519.       The filename can include a complete path. If a path is not
  2520.       included then the file is opened in the Easy Base System
  2521.       directory.
  2522.       If the filename supplied is that of an existing file, that file
  2523.       is opened for access with the Read or Write commands. If there
  2524.       is no file with the supplied filename then a new file with that
  2525.       name is created and opened.
  2526.       Ex.
  2527.       Open "C:\config.sys"
  2528.       Open Files.name
  2529.       Open jointext("C:\wp\",input.filename)
  2530.       See also: Close, Seek, Read, Write, Find, Erase
  2531.                                 - 91 -
  2532. ................................................................................
  2533.       OPERATORS            
  2534. ARITHMETIC       
  2535. OPERATORS
  2536.       The arithmetic operators used in Easy Base are:-
  2537.       +   (addition)
  2538.       -   (subtraction and negation)
  2539.       *   (multiplication)
  2540.       /   (division)
  2541.       ^   (exponentiation)
  2542.       Where there are multiple operators in a derivation they are
  2543.       processed with the following precedence:-
  2544.       1.   Exponentiation
  2545.       2.   Negation
  2546.       3.   Multiplication and Division
  2547.       4.   Addition and Subtraction
  2548.       The default precedence can be altered by the use of
  2549.       parenthesis.
  2550.            Easy base does not perform Integer Arithmetic.
  2551.       When a numeric field shows the result of a division the
  2552.       "displayed" number is "truncated" to an integer in Integer
  2553.       fields and has the last digit rounded in Fixed Point and
  2554.       Floating Point fields.  The "Stored" value which is used in any
  2555.       further calculations, however, is always correct to 15
  2556.       significant figures irrelevant of field type.  For Example: If
  2557.       three fields x,y and z are defined as integers, y is derived as
  2558.       x/4 and z is derived as y*4 then when 9 is entered in x, y will
  2559.       derive as 2 but z will derive as 9 because it multiplies the
  2560.       "stored value" of 2.25 by 4 not the displayed value of 2.
  2561.       Handling arithmetic in this way means that, by default there
  2562.       are no rounding errors. This has several advantages not least
  2563.       that currency values need only ever be defined to two decimal
  2564.       places.
  2565.       It does mean, however, that should you require rounding errors
  2566.       to be carried forward you must use one of the Easy Base
  2567.       rounding functions on the result of any intermediate division.
  2568.       In the above example, had y been derived as "round(x/4)" then z
  2569.       would derive as 8.
  2570.       If a fourth field had the formula:- if(y = 2,5,10) it would
  2571.       only derive as 5 if y had been rounded or if 8 had been entered
  2572.       in x.
  2573.                                 - 92 -
  2574. ................................................................................
  2575.       OPERATORS            
  2576. RELATIONAL       
  2577. OPERATORS
  2578.       Easy base uses the following relational operators:-
  2579.       =    (equals)
  2580.       <>   (not equals)
  2581.       >    (greater than)
  2582.       <    (less than)
  2583.       >=   (greater than or equal to)
  2584.       <=   (less than or equal to)
  2585.       Where relational operators and arithmetic operators are both
  2586.       used in a derivation. Relational operations are performed after
  2587.       arithmetic operations.
  2588.       Text values are not case sensitive when compared with
  2589.       relational operators.
  2590.       When you compare two fields or variables, the comparison is
  2591.       numeric if both are numeric and alphabetic if both are
  2592.       alphabetic.  If you compare a numeric field with a text field
  2593.       then Easy Base will test to see if the text field contains a
  2594.       number.  If it does then the comparison will be numeric and if
  2595.       it does not then the comparison will be alphabetic.
  2596.       WARNING
  2597.       If you compare the result of a division in an integer or fixed
  2598.       point field using the = or the <> operators, then the value
  2599.       used for comparison will be the (accurate) stored value and not
  2600.       the "Truncated" number shown in the field.
  2601.       See Operators Arithmetic
  2602.                                 - 93 -
  2603. ................................................................................
  2604.       OPERATORS            
  2605. LOGICAL         
  2606. OPERATORS
  2607.       Easy Base uses the following logical operators:-
  2608.       1.  and
  2609.       2.  or
  2610.       3.  xor     (or exclusive)
  2611.       4.  eqv     (equivalence)
  2612.       5.  imp     (implication)
  2613.       Logical operations are performed last after arithmetic and
  2614.       relational.
  2615.       Logical operators return a boolean (true or false) value from
  2616.       two other boolean expressions.
  2617.       Ex.
  2618.       If(x = y and a = b,"Yes","No")
  2619.          < Yes is returned if both expressions are true >
  2620.       If(x = y or a = b,"Yes","No")
  2621.          < Yes is returned if either or both expressions are true >
  2622.       If(x = y xor a = b,"Yes","No")
  2623.          < Yes is returned if either one but not both are true >
  2624.       If(x = y eqv a = b,"Yes","No")
  2625.          < Yes is returned if both expressions are true or if both
  2626.            expressions are false >
  2627.       If(x = y imp a = b,"Yes","No")
  2628.          < Yes is returned for all combinations except the first
  2629.            expression being true and the second false >
  2630.       The Easy Base logical operators are primarily designed for use
  2631.       within the "If" function and in "If..Then..Else" constructions
  2632.       where their actual value is not relevant. If you wish to use
  2633.       the value of "false" in formulae then it is represented by 0.
  2634.       True can be represented by any value other than 0 and should
  2635.       not be used.
  2636.                                 - 94 -
  2637. ................................................................................
  2638.       OPTIONS              
  2639. UTILITY         
  2640. OPTIONS
  2641.       The "Options" utility allows you to select your preferred date
  2642.       format (European or North American).
  2643.       You can also enable or disable screen saving. If enabled the
  2644.       screen saver operates after three minutes without a keypress
  2645.       during record entry, procedure screen entry or if a menu is
  2646.       being displayed. The screensaver is never invoked while a
  2647.       procedure is running or while reformatting or re-indexing is
  2648.       taking place.
  2649.       The third option allows you to select the border style you
  2650.       require around menus and message boxes.
  2651.       Option four selects whether or not screen clearing will be done
  2652.       with the curtain effect.
  2653.       Option five selects the COM port which will be used during
  2654.       Auto-dialling.
  2655.       The options utility can be called as a user menu function so
  2656.       that an end user can access the facilities without access to
  2657.       the system menus.
  2658.                                 - 95 -
  2659. ................................................................................
  2660.       OUTPUT               
  2661. SYSTEM VALUE      
  2662. OUTPUT
  2663.       When a user runs a procedure his choice of output, screen,
  2664.       printer or disk is stored in the system value "Output".
  2665.       By accessing the system value "Output" you can make your
  2666.       procedure do different things depending on where the output is
  2667.       to be sent.
  2668.       Ex.
  2669.       if output = "screen" then
  2670.          print heading1
  2671.       else
  2672.          print heading2
  2673.       end if
  2674.                                 - 96 -
  2675. ................................................................................
  2676.       Pack                 
  2677. Procedure Command   
  2678.       Network Versions only.
  2679.       Form packing can be initiated within a procedure.
  2680.       Syntax: Pack formname
  2681.       Example:
  2682.       Lock Clients
  2683.       For Clients with name = input.name
  2684.          delete record
  2685.       next
  2686.       Pack Clients
  2687.       Unlock Clients
  2688.       The Pack command must not be executed within a for or do loop.
  2689.                                 - 97 -
  2690. ................................................................................
  2691.       PACK DATA FORMS      
  2692. UTILITY         
  2693. PACK DATA FORMS
  2694.       The process of actually removing a deleted record from a form
  2695.       is time consuming. What actually happens is that all the "Live"
  2696.       records are copied to a temporary file. The original file is
  2697.       then deleted and the temporary one re-named to the original
  2698.       name. Because of this it is actually quicker to remove fifty
  2699.       "Dead" records than it is to remove one. To save you time Easy
  2700.       base follows the traditional data-base custom of simply marking
  2701.       records for deletion when you delete them. They are only
  2702.       physically removed from the form during a "Pack" operation.
  2703.       When you "Pack" a data file Easy Base also re-writes all the
  2704.       index files for that form. You can pack individual forms with
  2705.       the "Pack Data Forms" utility accessed from the Utilities menu.
  2706.       You can also call the "Pack Data Forms" utility as a User menu
  2707.       function. In a finished application any necessary packing would
  2708.       normally be done from a batch execute menu which would run
  2709.       while the computer was unattended.
  2710.       Forms in which records are regularly deleted should be packed
  2711.       regularly. If packing is not done then not only will you be
  2712.       wasting disk space but search operations will become
  2713.       progressively slower as the percentage of "Dead" records
  2714.       increases.
  2715.       This is fairly obvious - however it is not so obvious that a
  2716.       forms index files can accumulate "Dead" records even though
  2717.       none have been deleted from the main file. An index file is
  2718.       simply the indexed fields contents and record number arranged
  2719.       in order. If, having filed a record you then alter the contents
  2720.       of an indexed field and update the record then the original
  2721.       record in the index file is deleted and a new one entered.
  2722.       Index files with "Dead records" also waste disk space and slow
  2723.       search operations. You should therefore regularly pack any
  2724.       forms which are regularly updated.
  2725.       If you are unsure which forms need to be packed you can use the
  2726.       "Auto-Pack" utility which tests each form and each forms index
  2727.       files for "Dead" records. The form is packed if it or any of
  2728.       its index files is found to have more then 100 total or 10 per
  2729.       cent "Dead" records.
  2730.       Although "Auto-Pack" may seem the easy answer, an application
  2731.       will almost certainly have several forms with "Core" data which
  2732.       remain unchanged and therefore never require packing. If you
  2733.       can identify the forms which do need to be packed and do them
  2734.       individually or from a batch execute menu this will be less
  2735.       time consuming than always using the "Auto-Pack" facility.
  2736.                                 - 98 -
  2737. ................................................................................
  2738.       PAGE NUMBER          
  2739. SYSTEM VALUE      
  2740. PAGE NUMBER
  2741.       Whenever Easy Base is processing a procedure with an output it
  2742.       keeps track of the current page number (Even if you have not
  2743.       included Page Feed commands). You can use the system value
  2744.       "Page Number" to number the pages of your output. To use the
  2745.       "Page Number" value just include "Page Number" in your output
  2746.       field declarations.
  2747.       Declare output fields
  2748.          Customers.name : Customers.ACNO : Page Number
  2749.       end
  2750.       You can then use the "Page Number" field in the Page Header or
  2751.       Page Footer section of your output format.
  2752.                                 - 99 -
  2753. ................................................................................
  2754.       PAUSE ON/OFF         
  2755. PROCEDURE COMMAND   
  2756. PAUSE ON/OFF
  2757.       When an Easy Base procedure has an output to the screen, the
  2758.       output, by default scrolls continuously until the procedure is
  2759.       complete. You can allow the user to pause the output with the
  2760.       "Pause On" and "AutoPause On" commands.
  2761.       If a procedure performs several tasks then the pause facility
  2762.       can be selectively enabled and disabled at any point.
  2763.       Ex.
  2764.       for employees alias types with type in order unique
  2765.          pause off:escape off
  2766.          for employees alias group with type = types.type
  2767.             subindex surname
  2768.          next
  2769.          pause on
  2770.          for employees with subindex in order
  2771.             print list items
  2772.          next
  2773.       next
  2774.       The above code fragment prints employees details in type groups
  2775.       with surname in alphabetic order. During the procedure the user
  2776.       can pause the report while it is listing the output but not
  2777.       while it is subindexing the group.
  2778.       If you set pausing with "Pause On" then the user can pause the
  2779.       output at any point by pressing the return key. If you set
  2780.       pausing with "Autopause On" then the output stops after each
  2781.       screen page of output.
  2782.       If you set "Autopause On" and "Escape On" then the first press
  2783.       of the Escape key cancels the autopausing and the second press
  2784.       terminates the output.
  2785.       "Pause Off" cancels either.
  2786.       If a procedure has pausing set by "Autopause On" and its output
  2787.       is directed to the printer, Easy Base automatically switches to
  2788.       "Pause On"
  2789.       See also: Escape On/Off
  2790.                                 - 100 -
  2791. ................................................................................
  2792.       PI                   
  2793. SYSTEM VALUE      
  2794.       You can use the value of 
  2795.  anywhere in field derivations or
  2796.       procedure code by quoting "Pi".
  2797.       Ex     circlearea = Pi / 4 diam^2
  2798.                                 - 101 -
  2799. ................................................................................
  2800.       PRESELECT            
  2801. PROCEDURE COMMAND   
  2802. PRESELECT
  2803.       The "Preselect" command sets highlighting of the next user menu
  2804.       when the procedure terminates.  If a procedure is normally
  2805.       followed by a particular selection from the menu then you can
  2806.       save the user the trouble of choosing it by issuing the
  2807.       "Preselect" command within the procedure.
  2808.       for currentcustomer
  2809.          currentcustomer.acno = input.acno
  2810.          update record
  2811.       next
  2812.       preselect 4
  2813.       The parameter cannot be supplied as a variable.
  2814.                                 - 102 -
  2815. ................................................................................
  2816.       PRINT                
  2817. PROCEDURE COMMAND   
  2818. PRINT
  2819.       In Easy Base procedures, all output to the screen or printer is
  2820.       initiated with the "Print" command. The "Print" command prints
  2821.       sections from the procedures output format.
  2822.       Ex.
  2823.       '......................procedure code....
  2824.       Print report header
  2825.       for customers
  2826.          print list items
  2827.       next
  2828.       print report footer
  2829.       '......................Output Format.......
  2830.       .Report Header
  2831.             
  2832.                           Customer List
  2833.             
  2834.       .List Items
  2835.             {customers.name field}  {customers.phone field}
  2836.       .Report Footer
  2837.             
  2838.       .end
  2839.       The format sections are marked with a full stop in the margin
  2840.       followed by the section name. When you type a full stop in the
  2841.       margin of the "Format editor" Easy Base will offer you a
  2842.       selection of section names. You do not have to use these - they
  2843.       are just some common names that can save you time. To enter
  2844.       your own section names just press escape and type in any name
  2845.       you wish.
  2846.       The ".end" section is not strictly necessary but it is easy to
  2847.       accidentally insert blank lines at the end of your format. By
  2848.       inserting ".end" at the end of the last section you will
  2849.       prevent these from being printed.
  2850.                                 - 103 -
  2851. ................................................................................
  2852.       PRINTER CONTROL      
  2853. PROCEDURE COMMAND   
  2854. PRINTER CONTROL
  2855.       When you send a procedure output to the printer Easy Base will
  2856.       initialize your printer at ten characters per inch, six lines
  2857.       per inch in draft mode.
  2858.       You can alter the printer mode anywhere within a procedure with
  2859.       the following printer controls.
  2860.       Bold On            Bold Off
  2861.       Underline On       Underline Off  (Underlines field contents)
  2862.       Italic On          Italic Off
  2863.       NLQ On             NLQ Off
  2864.       8 lpi      Sets printing to eight lines per inch
  2865.       6 lpi      Sets printing to six lines per inch
  2866.       10 cpi     Sets printing to ten characters per inch
  2867.       12 cpi     Sets printing to twelve characters per inch
  2868.       17 cpi     sets printing to either 15 or 17 depending on
  2869.                  printer
  2870.       Line Feed  Advances the print head one line
  2871.       Page Feed  Ejects the current page.
  2872.       Landscape  Prints in landscape ( HP DeskJet/LaserJet only )
  2873.       Ex.
  2874.       NLQ On
  2875.       Bold on
  2876.       Print report header
  2877.       Bold Off
  2878.       12 CPI
  2879.       For customers
  2880.          print list items
  2881.          if bottom margin < 1.5 then
  2882.             Line feed : Bold On : 10 CPI
  2883.             Print Page footer
  2884.             Page feed
  2885.             Print Page header
  2886.             Bold Off : 12 CPI
  2887.          end if
  2888.       next
  2889.       Bold on:Italic On :10 CPI
  2890.       print report footer
  2891.       The above example turns Near Letter Quality printing on for the
  2892.       entire report. It prints page headers and footers in bold at 10
  2893.       characters per inch, list items at 12 characters per inch and
  2894.       the report footer in bold italics.
  2895.                                 - 104 -
  2896. ................................................................................
  2897.       Prog_Dir             
  2898. System Value      
  2899. Prog_Dir
  2900.       Whenever you run a procedure in Easy Base the drive and
  2901.       directory of the program files is available in the system value
  2902.       Prog_Dir.
  2903.       If you write applications for resale on the Easy Base Runtime
  2904.       module then you will not necessarily know the name of the
  2905.       directory to which the end user has installed your application.
  2906.       If your application opens external files you can ensure that
  2907.       they are in the Application directory by using Prog_Dir.
  2908.       declare variables
  2909.          pathfile as text
  2910.       end
  2911.       pathfile = jointext(Prog_Dir,"\NAMES.TXT")
  2912.       open pathfile
  2913.                                 - 105 -
  2914. ................................................................................
  2915.       PROPER               
  2916. FUNCTION        
  2917. PROPER
  2918.       This function returns the parameter with the first letter of
  2919.       each word in upper case and the rest in lower case. If you wish
  2920.       to enter initials in a field derived as proper and keep them in
  2921.       upper case then there must either be a space or a full stop
  2922.       between them.
  2923.       Ex.     Proper(Address)
  2924.       Ex.
  2925.       labelname = upper(company.name)
  2926.       insetname = proper(company.name)
  2927.       Acceptable parameters:
  2928.       Quoted text
  2929.       Text field/variable
  2930.                                 - 106 -
  2931. ................................................................................
  2932.       RANDOM               
  2933. FUNCTION        
  2934. RANDOM
  2935.       This function returns a random number between the upper and
  2936.       lower parameters.
  2937.       Ex.  Random(1,100)
  2938.          <Returns a random number between 1 and 100>
  2939.       Ex.  The two fields No and card simulate the random cutting of
  2940.       a deck of cards each time the No field is cleared.
  2941.       No field derivation:-
  2942.           if(no <> blank,no,random(1,52))
  2943.       Card field derivation:-
  2944.           jointext(if(mod(no,13) = 1,"Ace",mod(no,13) = 0,"King",
  2945.       mod(no,13) = 12,"Queen",mod(no,13) = 11,"Jack",mod(no,13)),
  2946.       " of ",if(no < 14,"Hearts",no < 27 ,"Clubs",no <40,"Diamonds",
  2947.       ,"Spades"))
  2948.       Acceptable parameters
  2949.       Numeric Value
  2950.       Numeric expression
  2951.       Numeric field/variable
  2952.       Any other function which returns a numeric value
  2953.                                 - 107 -
  2954. ................................................................................
  2955.       Read                 
  2956. File Command      
  2957.       The "Read" command reads data from a non Easy Base file which
  2958.       has been opened with the "Open" command.
  2959.       The syntax is:
  2960.       Read (Length) to (Field or variable)
  2961.       Length can be absolute, a variable or field or the keyword
  2962.       "Line".
  2963.       Ex.
  2964.       Read 45 to Keyvar
  2965.       Read GetLen to customers.name
  2966.       Read Line to Linestring
  2967.       In the "Line" example Easy Base reads from the current File_pos
  2968.       to the end of the current ASCII line.
  2969.       See also: Open, Close, Seek, Write, Find, Erase
  2970.                                 - 108 -
  2971. ................................................................................
  2972.       REBUILD DIRECTORIES  
  2973. UTILITY         
  2974. REBUILD DIRECTORIES
  2975.       In Easy Base, all DOS file handling is taken care of for you in
  2976.       the background. To do this Easy Base maintains three
  2977.       "Directory" files in which the names which you give to forms,
  2978.       procedures and choice field lists are linked to the actual DOS
  2979.       filenames.
  2980.       The three files are :-
  2981.       BASE.DIR     The forms directory
  2982.       PROC.DIR     The procedures directory
  2983.       CHOICES.DIR  The choice list directory
  2984.       Because these are key files, Easy Base includes a utility which
  2985.       will rebuild them in the event of accidental erasure or
  2986.       corruption.
  2987.                                 - 109 -
  2988. ................................................................................
  2989.       Recall Input Screen  
  2990. Procedure Command   
  2991. Recall Input Screen
  2992.       The Recall Input Screen command, available in network versions
  2993.       only, is used to return to the input screen when an error is
  2994.       detected after a procedure starts. Such errors are invariably
  2995.       caused by multiple work stations running the same procedure at
  2996.       the same time. A typical example would be when a procedure
  2997.       enters a record to a form and one of the fields has to be
  2998.       unique. If two work stations enter the same value for the
  2999.       unique field on their input screens, the error cannot be
  3000.       detected until the procedure is run. The following procedure
  3001.       code illustrates how a procedure can test to see if another
  3002.       workstation has entered the same value in the name field of the
  3003.       parts form.
  3004.       Declare variables
  3005.          x as number
  3006.       end
  3007.       For parts new record
  3008.          For Parts alias check with name = input.name
  3009.             x = x + 1
  3010.          Next
  3011.          if x > 0 then
  3012.             Beep
  3013.             Display status "This Part Name Has just been taken !"
  3014.             Delay 2000
  3015.             Recall Input Screen
  3016.          end if
  3017.          copy all from input
  3018.       next
  3019.       The Recall Input Screen command automatically preserves all the
  3020.       field data that had been entered on the input screen irrelevant
  3021.       of the screen's F12 setting for "Clear Screen after Running".
  3022.                                 - 110 -
  3023. ................................................................................
  3024.       RECORD NUMBER        
  3025. SYSTEM VALUE      
  3026. RECORD NUMBER
  3027.       If you derive a field with the formula "record number" it will
  3028.       be filled with the record number at the time of filing or
  3029.       reformatting.  Record number differs from "sequence" in the
  3030.       following way. Each time you derive a field with "sequence" you
  3031.       get the next sequencial number irrespective of whether the form
  3032.       has had records deleted and has been repacked. If a file has
  3033.       had at some time 500 records but now only has 20 the next
  3034.       derivation of "sequence" will be 501 and the next derivation of
  3035.       "record number" will be 21.
  3036.       The main use of "record number" is to renumber a set of records
  3037.       after deletions. To do this just add a new field to the form
  3038.       derived as record number. The field will be filled
  3039.       automatically during the data reformatting process.
  3040.       In procedures a records number is available as a pseudo field.
  3041.       Declare Output Fields
  3042.          Customers.Name
  3043.          Customers.Record number
  3044.       end
  3045.                                 - 111 -
  3046. ................................................................................
  3047.       REMARK               
  3048. PROCEDURE COMMAND   
  3049. REMARK
  3050.       You can place remarks anywhere within Easy base procedure code
  3051.       by prefixing them with an apostrophe.
  3052.       Ex.
  3053.       '.................This entire line is a remark.....
  3054.       for pupils with age > 9
  3055.          if grade = "g" then skip record   'exclude g's from count
  3056.          count = count + 1                 'These are remarks
  3057.       next
  3058.       '..............................................
  3059.       All text to the right of the apostrophe is ignored at run time.
  3060.                                 - 112 -
  3061. ................................................................................
  3062.       Reset Sequence       
  3063. Procedure Command   
  3064. Reset Sequence
  3065.       The reset sequence command (Network Versions only) can be used
  3066.       to reset the sequence number for any given form. The following
  3067.       code resets the sequence number for the customers form to 1000.
  3068.       For Customers
  3069.          Customers.Sequence = 1000
  3070.          Reset Sequence
  3071.          Exit For
  3072.       Next
  3073.                                 - 113 -
  3074. ................................................................................
  3075.       RESTORE              
  3076. UTILITY         
  3077. RESTORE
  3078.       Easy Base will restore applications or data which it has backed
  3079.       up. You can only restore an application with the "Restore
  3080.       Application" utility called from the utilities menu and you can
  3081.       only restore data-only backups with the "Restore Data" utility
  3082.       called from a user menu.
  3083.       See Also:-  Backup
  3084.                                 - 114 -
  3085. ................................................................................
  3086.       RETAIL               
  3087. FUNCTION        
  3088. RETAIL
  3089.       The retail function returns the retail price given the
  3090.       wholesale price and the discount as a percentage of retail.
  3091.       Ex   Retail(cost,discount)
  3092.            < returns 125 if cost = 100 and discount = 20>
  3093.                                 - 115 -
  3094. ................................................................................
  3095.       RETEST               
  3096. DERIVATION PREFIX   
  3097. RETEST
  3098.       In Easy Base, fields are derived when a new record is started
  3099.       and when any other field which affects the derivation is
  3100.       changed. You can force a field to be rederived when F2 is
  3101.       pressed by prefixing the derivation with "retest".
  3102.       Suppose you have a field "degrees" in which the user must enter
  3103.       a number between 1 and 360.
  3104.       To prevent him entering an out of range number you could derive
  3105.       the field :-
  3106.       If(degrees<1 or degrees > 360,blank[beepInvalid number of
  3107.       degreesCursor degrees],degrees)
  3108.       The above derivation would prevent the user from filing a
  3109.       record with an out of range number. However, by the time he
  3110.       read the message, his entry would be blanked out. It would be
  3111.       better if the number he had typed could be left in the field so
  3112.       that he could see his error. To do this all you have to do is
  3113.       change "blank" to "degrees" in the above derivation.
  3114.       This however would allow the user ( Should he decide to ignore
  3115.       the message ) to then file the incorrect value. To leave the
  3116.       value in the field and still prevent the user from filing it,
  3117.       use the "retest" prefix.
  3118.       Retest If(degrees<1 or degrees > 360,degrees[beepInvalid number
  3119.       of degreesCursor degrees],degrees)
  3120.       Note:-
  3121.       1. You can have more than one prefix on any one field
  3122.          derivation provided there is a space between each.
  3123.                                 - 116 -
  3124. ................................................................................
  3125.       REVERSE              
  3126. FUNCTION        
  3127. REVERSE
  3128.       The reverse function is used in the creation of compound index
  3129.       fields. What it actually does is alter the characters of the
  3130.       parameter in such a way that an alphabetic listing of a field
  3131.       after reversal will have the reverse order to that of the
  3132.       original characters before using the reverse function.
  3133.       In the example shown for the function "zeropad", had you wished
  3134.       to list the pupils in descending age order there would be no
  3135.       point in using the procedure code:
  3136.       for pupils with unifield in reverse order
  3137.       as this would not only reverse the age grouping but would also
  3138.       reverse the name order.
  3139.       To produce the desired printout use exactly the same procedure
  3140.       but derive "unifield" as:-
  3141.       Jointext(reverse(zeropad(age,2,0)),name)
  3142.                                 - 117 -
  3143. ................................................................................
  3144.       RIGHTTEXT            
  3145. FUNCTION        
  3146. RIGHTTEXT
  3147.       This function returns a specified number of characters from the
  3148.       end of a field or variable.
  3149.       Ex    Righttext(name,10)
  3150.       Ex.   Righttext(datetext(system date),4)
  3151.             < returns  1993 , 1994 Etc.>
  3152.       Acceptable parameters:
  3153.       Text field/variable
  3154.       Any function returning a text value
  3155.                                 - 118 -
  3156. ................................................................................
  3157.       ROUND                
  3158. FUNCTION        
  3159. ROUND
  3160.       There are three rounding functions in Easy base:-
  3161.       Round
  3162.       Roundup
  3163.       Rounddown
  3164.       If a rounding function is called with a single parameter then
  3165.       the return value is the parameter rounded to the nearest
  3166.       integer value.
  3167.       Ex. Round(items/reps)
  3168.          < if items = 9 and reps = 4. 2 is returned >
  3169.       All rounding functions accept a second parameter indicating the
  3170.       number of decimal places (or powers of 10 if negative) to round
  3171.       to.
  3172.       Ex. Rounddown(vaton(net),2)
  3173.          < Rounds down the VAT on field "net" to the nearest penny.
  3174.       Ex. Jointext(roundup(if(mod(years,100) = 0,years+1,years),-2
  3175.           )/100,"th Century")
  3176.         < Returns "20th Century" for all values of years 1900-1999 >
  3177.       Round Produces a default rounding system in which:-
  3178.          2.4 rounds to  2
  3179.          2.5 rounds to  3
  3180.         -2.4 rounds to -2
  3181.         -2.5 rounds to -3
  3182.       In the Roundup and Rounddown functions the direction is sign
  3183.       sensitive:-
  3184.          2.5 roundsup to  3      2.5 roundsdown to  2
  3185.         -2.5 roundsup to -2     -2.5 roundsdown to -3
  3186.       Acceptable parameters:
  3187.       Numeric value
  3188.       Numeric expression
  3189.       Numeric field/variable
  3190.       Any other function which returns a numeric value
  3191.                                 - 119 -
  3192. ................................................................................
  3193.       RUN                  
  3194. FIELD CONTROL     
  3195.       The "run" control is used to initiate procedures with input
  3196.       screens without the user having to press F2.
  3197.       Ex.   If(lookup(customers,name) = blank,blank,lookup(customers,
  3198.             name)[run])
  3199.       In the above example, a procedure which lists customers
  3200.       accounts has an input screen with a single field where the
  3201.       customers name is entered. When the user enters a name the
  3202.       above derivation will test whether or not the entered name is a
  3203.       customer. If the entered name does not exist in the customers
  3204.       file the field will be blanked out but if it does then the
  3205.       procedure will run without the user having to press F2.
  3206.                                 - 120 -
  3207. ................................................................................
  3208.       RUN                  
  3209. PROCEDURE COMMAND   
  3210.       The "Run" command terminates the current procedure and starts
  3211.       another.
  3212.       The "Run" command can be used to chain procedures similar to
  3213.       placing them on a batch execute menu. Its main use, however, is
  3214.       to branch to other procedures depending on which function key
  3215.       was pressed from the input screen. Procedures can be initiated
  3216.       from their input screens by pressing any of the function keys
  3217.       F2, F4, F5, F7, F8, F9 or F10. The number of the function key
  3218.       which was pressed is returned in the system value "Fun_Key". If
  3219.       the procedure was initiated by the field control [Run] then the
  3220.       Fun_Key value returns 0.
  3221.       Example.
  3222.       If Fun_Key = 7 then Run Import1
  3223.       If Fun_Key = 8 then Run Import2
  3224.       If Fun_key = 2 then
  3225.          for customers with name = input.name
  3226.             print list items
  3227.          next
  3228.       end if
  3229.       If you press F1 after typing "Run" in the procedure code
  3230.       editor, Easy Base will list all your procedure names for you to
  3231.       pick from and ensure correct spelling.
  3232.       The Run command only transfers control to the next procedure
  3233.       when the main procedure is executed from a user menu. When you
  3234.       are developing your procedures in the procedure generator the
  3235.       called procedure cannot be loaded. If the code for a procedure
  3236.       being tested in the procedure generator reaches a "Run"
  3237.       command, the test ends with the message "Run call made to..OK"
  3238.       to let you know that the call will be made when the procedure
  3239.       is run live from a user menu.
  3240.       See also: Fun_Key Disable
  3241.                                 - 121 -
  3242. ................................................................................
  3243.       SCREEN COLOURS       
  3244. UTILITY         
  3245. SCREEN COLOURS
  3246.       The "Screen Colours" utility provides 14 pre defined colour
  3247.       sets including two for "Mono Graphics" cards together with a
  3248.       user defined setup. To change the colours of your system simply
  3249.       select "Screen Colours" from the Utilities menu and select the
  3250.       set you want.
  3251.       The "Screen Colours" utility can also be called as a User Menu
  3252.       function allowing an end user to change his screen set from
  3253.       your menus without accessing the system.
  3254.                                 - 122 -
  3255. ................................................................................
  3256.       SECONDS              
  3257. FUNCTION        
  3258. SECONDS
  3259.       This function returns the seconds number from the time
  3260.       parameter.
  3261.       Ex.    seconds(system time)
  3262.       Acceptable parameters:
  3263.       System time
  3264.       Time field
  3265.       Maketime function
  3266.       Time expression
  3267.                                 - 123 -
  3268. ................................................................................
  3269.       Seek                 
  3270. File Command      
  3271.       The "Seek" command moves the Read/Write pointer within a non
  3272.       Easy Base file which has been opened with the "Open" Command.
  3273.       The actual position of the pointer at any time is available in
  3274.       the system value File_Pos. The File_Pos value is the pointers
  3275.       current offset in bytes (Numbering the first byte as 1).
  3276.       The Seek Command accepts an actual offset, an offset relative
  3277.       to File_Pos or File_Len or an ASCII line movement.
  3278.       Examples.
  3279.       Seek 245
  3280.       Seek File_Pos + 35
  3281.       Seek File_Len - 20
  3282.       Seek Line_Forward
  3283.       Seek Line_Back
  3284.       You cannot combine an ASCII line movement with an offset -
  3285.       To read ten bytes starting at byte 30 on the next line you need
  3286.       two Seek commands.
  3287.       Seek Line_Forward
  3288.       Seek File_Pos + 29
  3289.       read 10 to Parts.No
  3290.       The line movement Line_Forward always positions the pointer at
  3291.       the start of the next line.
  3292.       The line movement Line_Back moves the pointer to the start of
  3293.       the current line if it is not already there and to the start of
  3294.       the previous line if it is.
  3295.       Some files (Eg. Email) have a non ASCII header followed by
  3296.       ASCII lines for the actual message. You can use Seek
  3297.       Line_Forward within a Do Loop to skip though the non ASCII
  3298.       part. If Line_Forward does not find a Carriage Return and Line
  3299.       Feed sequence within 255 bytes then it leaves the file pointer
  3300.       255 bytes ahead of its last position. There is no corresponding
  3301.       facility in Line_Back. If Line_Back does not find a line feed
  3302.       (or Start of File) within 255 bytes then the file pointer does
  3303.       not move.
  3304.       See also: Open, Close, Read, Write, Find, Erase
  3305.                                 - 124 -
  3306. ................................................................................
  3307.       SEQUENCE             
  3308. SYSTEM VALUE      
  3309. SEQUENCE
  3310.       When you create a new form a sequence value is updated each
  3311.       time a record is entered. The "sequence" value starts at 1 and
  3312.       continues to 2 billion irrespective of whether or not records
  3313.       have been deleted from the form. If you derive a field as
  3314.       "sequence" then each new record will have the next sequenced
  3315.       number. Sequence derivations are useful for such things as
  3316.       invoice numbers.
  3317.       A sequence field need not start at one however.
  3318.       Ex.  sequence + 1000 would number the first record 1001
  3319.       The sequence number for any form can be reset in procedure
  3320.       code.
  3321.       For Form
  3322.          Form.Sequence = 1
  3323.          Reset Sequence
  3324.          exit for
  3325.       next
  3326.                                 - 125 -
  3327. ................................................................................
  3328.       SET PAPER LENGTH     
  3329. UTILITY         
  3330. SET PAPER LENGTH
  3331.       The "Set Paper Length" utility is accessed from the
  3332.       Utilities menu and can also be called from a user menu.
  3333.       There are settings for A3, A4, A5, American Letter and
  3334.       American Legal in both portrait and landscape.
  3335.       When you change the paper length in use then you update
  3336.       pagination for all report outputs.
  3337.       The landscape options are for use in wide carriage printers
  3338.       where the paper can be fed in landscape orientation they do not
  3339.       produce "sideways" printing on narrow carriage printers.
  3340.       If the paper size you use is not one of those listed, select
  3341.       "Other" and you can enter the length and width of your paper
  3342.       manually.
  3343.       The Length is entered in "Lines" ( One Sixths of an inch ) and
  3344.       the width is entered in inches.
  3345.       For example, if your paper is 12 inches by 8.25 inches you
  3346.       would enter the length as 72 and the width as 8.25.
  3347.                                 - 126 -
  3348. ................................................................................
  3349.       Shell                
  3350. File Command      
  3351. Shell
  3352.       The "Shell" command executes a DOS command which you supply as
  3353.       the parameter.
  3354.       Shell "DIR C:\WP > C:\EB\DIR.TXT"
  3355.       This writes a directory listing of C:\WP to the file DIR.TXT
  3356.       which you can then open and read from.
  3357.       You can supply the parameter as quoted text, as a variable or
  3358.       field or with a function.
  3359.       Shell Jointext("copy C:\PROGS\",input.directory,"\*.* A:\")
  3360.       In this example a disk vendor can select programs by name on an
  3361.       input screen which looks up the directory in which the program
  3362.       is stored. The procedure then copies all files from that
  3363.       directory to the A: drive.
  3364.       Depending on the procedure you are running, Easy Base uses
  3365.       between 450K and 550K of base memory. You cannot therefore
  3366.       "Shell" to any major program. The main use of "Shell" is to use
  3367.       the DOS copy and Dir commands. You can also shell to a batch
  3368.       file of such commands if you have several tasks to perform.
  3369.       CAUTION
  3370.       The Easy Base Executable file expects to find its support files
  3371.       in the current default directory. If you change drive or
  3372.       directory while shelled out of Easy Base then you must change
  3373.       back before exiting the procedure.
  3374.       If you are writing an application for resale then remember that
  3375.       the end user might not have installed it to C:\EB. Change back
  3376.       to the correct drive and directory by using the system value
  3377.       "Prog_Dir".
  3378.       Declare variables
  3379.          Drive as text : Dir as text
  3380.       end
  3381.       drive = lefttext(prog_dir,2)
  3382.       dir = righttext(prog_dir,lengthtext(prog_dir)-3)
  3383.       shell "Job.Bat"
  3384.       shell drive
  3385.       shell jointext("CD\",dir)
  3386.       When you use "Shell" Easy Base clears the screen and pauses for
  3387.       any DOS error messages. If you know that the command you are
  3388.       about to shell to will not invoke a response from DOS you can
  3389.       add the keyword "Smooth" and Easy Base will not clear the
  3390.       screen or pause.
  3391.       Shell Smooth "DIR C:\FAX > C:\EB\DIR.TXT"
  3392.                                 - 127 -
  3393. ................................................................................
  3394.       Show PickList        
  3395. PROCEDURE COMMAND   
  3396. Show PickList
  3397.       In most instances where you select records for displaying,
  3398.       printing or further processing you will be able to select based
  3399.       on a group field or a range of field values. There will however
  3400.       be occasions where you need to select a set of records which
  3401.       are totally unrelated. To do this Easy Base includes a pre
  3402.       defined system form called "PickList". This form has two fields
  3403.       called "Item" and "Mark".  The PickList form is only accessible
  3404.       within procedures. You can process it just like one of your own
  3405.       forms (Except that you cannot "Create Temp as PickList") and
  3406.       you can display it at any point in a procedure with the command
  3407.       "Show PickList". The difference between PickList and any other
  3408.       form is that it displays as a table. The Item field is no entry
  3409.       and the Mark field is a choice field which is either Blank or
  3410.       ASCII 251 ( 
  3411.  ). After displaying the form you can continue
  3412.       your processing based on the value of the "Mark" field.
  3413.       As an example of the use of the picklist form, suppose that you
  3414.       had a contacts form with names and addresses. There is also a
  3415.       group field which is either Customer, Supplier, or Employee
  3416.       You want to send a circular letter to your Customers - but not
  3417.       all of them - only the ones you know personally. There is no
  3418.       sub grouping for this - you need to actually "Tick off" the
  3419.       ones you require from a list.
  3420.       ..........................................
  3421.       Declare output fields
  3422.          Contacts.Name : Contacts.address : date
  3423.       End
  3424.       For Contacts with Group = "Customer"
  3425.          For PickList new record
  3426.             Picklist.Item = Contacts.Name
  3427.          Next
  3428.       Next
  3429.       Show PickList
  3430.       For Picklist with Mark = Chr$(251)
  3431.          For Contacts with name = Picklist.Item
  3432.             Print Letter
  3433.          Next
  3434.       Next
  3435.       Clear Records from PickList
  3436.       ............................................
  3437.       At the line "Show Picklist" Easy Base will display all your
  3438.       customers names in a table which you can scroll through
  3439.       marking or unmarking the customers to which you wish to print
  3440.       the circular. When you Escape from the PickList form,
  3441.       processing continues in the procedure code, printing the Letter
  3442.       only to those customers which you have "Ticked" ie with the
  3443.       "Mark" field = Chr$(251).
  3444.       PickList is not a temporary form. You can add or delete records
  3445.       in one procedure and show it in another. You must clear records
  3446.       from one usage before the next.
  3447.       Cont.
  3448.                                 - 128 -
  3449. ................................................................................
  3450.       Show PickList        
  3451. PROCEDURE COMMAND   
  3452. Show PickList
  3453.       The Item field in Picklist is a text field 80 characters in
  3454.       length. You can show from 1 to 65 characters of this field by
  3455.       stating the length after the command "Show PickList 20" If you
  3456.       do not enter a length the default is 35. There is no problem
  3457.       allocating numeric values to PickList.Item but you cannot show
  3458.       a Time field. You cannot show a date field directly but you can
  3459.       use Picklist for dates if you have a field with the date shown
  3460.       in text derived with the datetext function.
  3461.       For Events with Type = "Committee Meeting"
  3462.          For PickList new record
  3463.             Picklist.Item = Events.Dateastext
  3464.             PickList.Mark = Chr$(251)
  3465.          next
  3466.       Next
  3467.       Show PickList 18
  3468.       In the above example you will see that the "Mark" field is also
  3469.       pre filled. In this case, when the list displays, all the dates
  3470.       will be pre marked.
  3471.       The following keys are active when PickList is displayed.
  3472.       Up Down PgUp PgDn Home End
  3473.       Space     Marks or unmarks individual items
  3474.       F4        Marks or unmarks all items
  3475.       F5        Swaps marked for unmarked
  3476.       F10       Makes a shortlist of marked items only
  3477.       F2        Returns to the procedure code.
  3478.                                 - 129 -
  3479. ................................................................................
  3480.       SKIP GROUP           
  3481. PROCEDURE COMMAND   
  3482. SKIP GROUP
  3483.       The "Skip Group" command excludes an entire group of records
  3484.       from selection by a "For" loop.
  3485.       Ex.
  3486.       for employees with type in order
  3487.          if employees.type = "Part time" then skip group
  3488.          print list items
  3489.       next
  3490.       The "Skip Group" command is not the same as filtering with a
  3491.       "<>" condition.  You could achieve the same result with :-
  3492.       for employees with type in order
  3493.          if employees.type <> "Part time" then
  3494.             print list items
  3495.          end if
  3496.       next
  3497.       but the second procedure would take much longer to run as each
  3498.       part time employee's record would be loaded into memory only to
  3499.       be rejected by the "If" condition.  The first procedure on the
  3500.       other hand only loads a single part time employee's record then
  3501.       skips the entire group by advancing the index pointer in use
  3502.       for record selection.
  3503.       You can also use the "Skip Group" command to terminate
  3504.       selection of a group of records at a given point.
  3505.       declare variables
  3506.          count as number
  3507.       end
  3508.       for employees with type in order
  3509.          count = count + 1
  3510.          if count = 51 then
  3511.             count = 0
  3512.             skip group
  3513.          end if
  3514.          print list items
  3515.       next
  3516.       The above procedure prints the first fifty employees in each
  3517.       "type" group.
  3518.       The "Skip Group" command can be shortened to "Skipgrp"
  3519.       IMPORTANT: The condition for the Skip Group cannot be nested
  3520.       within another "If" condition or "DO LOOP" structure which is
  3521.       itself within the current "For" loop.
  3522.       :- See Skip Record for example.
  3523.                                 - 130 -
  3524. ................................................................................
  3525.       SKIP RECORD          
  3526. PROCEDURE COMMAND   
  3527. SKIP RECORD
  3528.       The "Skip Record" command is used to exclude individual records
  3529.       from selection in a "For" Loop.
  3530.       Ex.
  3531.       for employee with worksno in order
  3532.          if employees.worksno = 12 then skip record
  3533.          print list items
  3534.       next
  3535.       The "Skip Record" command has exactly the same effect as
  3536.       filtering with a "<>" condition but is much easier to write if
  3537.       there are many items to exclude
  3538.       for employees with worksno in order
  3539.          if employees.worksno = 12 or employees.worksno = 15 then
  3540.             skip record
  3541.          end if
  3542.          if employees.name = "smith" then skip record
  3543.          if employees.age > 50 then skip record
  3544.       next
  3545.       You can exclude groups of records from an inner loop by
  3546.       applying the "Skip Record" command to a "Unique" outer loop.
  3547.       for employees alias types with type in order unique
  3548.          if types.type = "director" then skip record
  3549.          if types.type = "part time" then skip record
  3550.          for employees with type = types.type
  3551.             print list items
  3552.          next
  3553.       next
  3554.       If you need to exclude groups of records from a single loop you
  3555.       must use the "Skip Group" command.
  3556.       The "Skip Record" command can be shortened to "Skiprec".
  3557.       IMPORTANT:
  3558.       The Skip Record command causes a direct jump to the start of
  3559.       the next iteration of the current "For" loop. The condition
  3560.       for the Skip Record must not be nested within another "If"
  3561.       condition or "Do Loop" structure which is itself within the
  3562.       current For loop.
  3563.       for form
  3564.          if (condition) then
  3565.             if form.type = "Part time" then skip record
  3566.          end if
  3567.       next
  3568.                    This will cause a system error.
  3569.                                 - 131 -
  3570. ................................................................................
  3571.       SPACEPAD             
  3572. FUNCTION        
  3573. SPACEPAD
  3574.       The Spacepad function pads a text variable to a given length
  3575.       with spaces.
  3576.       Ex.   Spacepad(name,10)
  3577.             < returns "Fred      " if name = "Fred"
  3578.       The spacepad function is used in the creation of compound index
  3579.       fields.
  3580.       For example:    A "Films" form has the fields "title" and
  3581.       "category". To list the films grouped by category in order and
  3582.       with the titles in each category in order create the field
  3583.       "groupindex" as text,long enough to hold both category and
  3584.       title fields and derived as :-
  3585.       Jointext(spacepad(category,15),title)
  3586.                       {15 is length of category field}
  3587.       You can then produce the required printout with the following
  3588.       procedure.
  3589.       ....................format.........................
  3590.       .Report header
  3591.         
  3592.                        FILM LIST BY CATEGORY
  3593.         
  3594.       .Group header
  3595.         Films in {category field}
  3596.       .List items
  3597.        {title field} Starring {Star field} Running time {length Fld}
  3598.       .end
  3599.       ......................procedure code.................
  3600.       declare output fields
  3601.          films.title:films.star:films.length:films.category
  3602.       end
  3603.       declare variables
  3604.          catcheck as text
  3605.       end
  3606.       '............
  3607.       bold on
  3608.       print report header
  3609.       for films with groupindex in order
  3610.          if films.category <> catcheck then
  3611.             bold on
  3612.             print group header
  3613.             bold off
  3614.          end if
  3615.          print list items
  3616.       next
  3617.                                 - 132 -
  3618. ................................................................................
  3619.       SPELLDAY             
  3620. FUNCTION        
  3621. SPELLDAY
  3622.       This function spells out the day of the number (1-7) parameter.
  3623.       Ex.   Spellday(dayofweek(system date))
  3624.       Acceptable parameters:
  3625.       Numeric value                              (1-7)
  3626.       Numeric expression evaluating to           (1-7)
  3627.       Numeric Field/variable holding value       (1-7)
  3628.       Any function returning a numeric value     (1-7)
  3629.                                 - 133 -
  3630. ................................................................................
  3631.       SPELLMONTH           
  3632. FUNCTION        
  3633. SPELLMONTH
  3634.       This function spells out the day of the number (1-12)
  3635.       parameter.
  3636.       Ex.   Spellmonth(month(system date))
  3637.       Ex.   Month = Spellmonth(month(invoices.date))
  3638.       Acceptable parameters:
  3639.       Numeric value                           (1-12)
  3640.       Numeric expression evaluating to        (1-12)
  3641.       Numeric Field/variable holding value    (1-12)
  3642.       Any function returning a numeric value  (1-12)
  3643.                                 - 134 -
  3644. ................................................................................
  3645.       START HERE           
  3646. DERIVATION PREFIX   
  3647. START HERE
  3648.       If, in a form or procedure input screen, you want the cursor to
  3649.       start in other than the top left field then derive the field in
  3650.       which you wish the cursor to start with "Start here" .
  3651.       If the field in which the cursor is to start already has a
  3652.       derivation then simply prefix the derivation with "Start here".
  3653.       Ex.
  3654.       start here Lookup(customers,name)
  3655.       1. You can have more than one prefix on any one field
  3656.          derivation provided there is a space between each.
  3657.                                 - 135 -
  3658. ................................................................................
  3659.       STRINGOF             
  3660. FUNCTION        
  3661. STRINGOF
  3662.       This function returns a string of characters.
  3663.       Ex.   Stringof(12,"-")
  3664.              < Returns "------------">
  3665.       Ex.  Stringof(5,chr$(240))
  3666.             < Returns "
  3667.       One of the most useful applications of the "Stringof" function
  3668.       is to pad output fields in tabular reports with "." characters.
  3669.       Ex.
  3670.       Declare output fields
  3671.          stock.name : stock.price
  3672.       end
  3673.       for stock with name in order
  3674.          stock.name = jointext(stock.name,stringof(30-lengthtext(
  3675.                       stock.name),".")
  3676.          print list items
  3677.       next
  3678.       The printed output from the above report would be in the form:-
  3679.             Gizmo.........................  2.50
  3680.             Sprocket......................  9.95
  3681.             Widget........................  3.10
  3682.       Acceptable parameters:
  3683.       1   Any numeric field, variable, expression or function
  3684.       2   Single quoted character - Function returning a single
  3685.           character
  3686.                                 - 136 -
  3687. ................................................................................
  3688.       SUBINDEX             
  3689. PROCEDURE COMMAND   
  3690. SUBINDEX
  3691.       The command Subindex is used to create an index file which
  3692.       contains only a subset of the records in a form.
  3693.       Subset indices are used in reports to output records in the
  3694.       order of one field when they have been selected using the index
  3695.       file on another field. For example, if you wish to list all the
  3696.       employees who work at the "Manchester" branch with their
  3697.       surnames in order you need to select the records using the
  3698.       index on the "Branch" field but you need to list them using an
  3699.       index on the "Surname" field. Since you can only use one index
  3700.       at a time you need to create an index on "Surname" which only
  3701.       contains the records which have "Manchester" as the branch.
  3702.       For Employees with branch = "Manchester"
  3703.          Subindex surname as #1
  3704.       next
  3705.       for Employees with subindex 1 in order
  3706.          print list items
  3707.       next
  3708.       You can have up to nine subset indices in any one procedure and
  3709.       you can select subsets from subsets. For example, if, in the
  3710.       employees list you only wished to list female employees whose
  3711.       salary was greater than 50,000 you would use:-
  3712.       For Employees with branch = "Manchester"
  3713.          Subindex sex as #1
  3714.       next
  3715.       For Employees with subindex 1 = "Female"
  3716.          Subindex salary as #2
  3717.       next
  3718.       For Employees with subindex 2 > 50000
  3719.          Subindex surname as #3
  3720.       next
  3721.       for Employees with subindex 3 in order
  3722.          Print List Items
  3723.       next
  3724.       Subset indices are temporary files. You cannot use a subset
  3725.       index in one procedure that was created in another.
  3726.       Within one procedure, however, you can use a subset index
  3727.       almost as if it were a form. You can add records to it as often
  3728.       as you wish before using it and you can erase its contents with
  3729.       the "Clear records from" command.
  3730.       Clear records from subindex 1
  3731.       This allows you to build subsets with multiple selections eg.
  3732.       Employees with branch = "Manchester" or branch = "Birmingham"
  3733.       and to reuse a subset index in a nested loop eg. Employees
  3734.       grouped by branch in surname order.
  3735.                                 - 137 -
  3736. ................................................................................
  3737.       SUBINDEX             
  3738. PROCEDURE COMMAND   
  3739. SUBINDEX
  3740.       Example of multiple selections:
  3741.       For Employees with branch = "Manchester"
  3742.          Subindex surname as #1
  3743.       next
  3744.       For Employees with branch = "Birmingham"
  3745.          Subindex surname as #1
  3746.       next
  3747.       For Employees with subindex 1 in order
  3748.          Print List Items
  3749.       next
  3750.       Example of nested subset:
  3751.       For Branches with name in order
  3752.          Print group header
  3753.          For Employees with branch = branches.name
  3754.             Subindex surname as #1
  3755.          next
  3756.          For Employees with subindex 1 in order
  3757.             Print List Items
  3758.          next
  3759.          Print group footer
  3760.          Clear records from subindex 1
  3761.       next
  3762.       In the first example, the records with branch = "Birmingham"
  3763.       are added to those with branch = "Manchester" and both are
  3764.       listed as a single subset.
  3765.       In the second example each individual branch subset is printed
  3766.       and then erased ready for the next.
  3767.       Whenever Easy Base is writing to a subset index the "Running"
  3768.       flash on the upper status line is replaced with "Sorting".
  3769.                                 - 138 -
  3770. ................................................................................
  3771.       SYSTEM DATE          
  3772. SYSTEM VALUE      
  3773. SYSTEM DATE
  3774.       You can use your computers inbuilt date anywhere in field
  3775.       derivations or procedure code by simply quoting "system date".
  3776.       Ex.
  3777.       for diary with date = system date
  3778.          print list items
  3779.       next
  3780.                                 - 139 -
  3781. ................................................................................
  3782.       SYSTEM TIME          
  3783. SYSTEM VALUE      
  3784. SYSTEM TIME
  3785.       You can use your computers inbuilt time anywhere in field
  3786.       derivations or procedure code by simply quoting "system time".
  3787.       Ex.
  3788.       for stockitems with stockno = input.stockno
  3789.          lastcheckeddate = system date
  3790.          lastcheckedtime = system time
  3791.          update record
  3792.       next
  3793.                                 - 140 -
  3794. ................................................................................
  3795.       TEXT                 
  3796. FIELD TYPE       
  3797.       The text field type can be up to 80 characters long.
  3798.       Cut copy and paste operations are available between all text,
  3799.       and textblock fields :
  3800.       Use Shift plus the arrow keys to mark the text you wish to cut
  3801.       or copy. When you release the keys the cut or copy choice will
  3802.       appear.
  3803.       To paste cut text position the cursor where you want it
  3804.       inserted and press Shift plus Ins.
  3805.       Spell Checking is also available in text fields -
  3806.          Press Ctrl + S
  3807.                                 - 141 -
  3808. ................................................................................
  3809.       TEXT BLOCK           
  3810. FIELD TYPE       
  3811. TEXT BLOCK
  3812.       When you Define a field with the field type "Text Block" then
  3813.       instead of entering a field length you shade out the area which
  3814.       you wish the field to cover using the arrow keys.
  3815.       Textblock fields offer many of the facilities of a
  3816.       wordprocessor including cut and paste, wordwrap and spell
  3817.       checking.
  3818.       Useful widths for A4 and Letter size paper are 63 characters if
  3819.       you intend to print at 10 characters per inch and 75 characters
  3820.       if you intend to print at 12 characters per inch. This document
  3821.       for instance was created in 63 character wide text blocks.
  3822.       The maximum width of a text block field on screen is 80
  3823.       characters. You can however redefine it up to 230 characters
  3824.       wide in procedure printouts and Easy Base will reformat your
  3825.       paragraphs to the new width.
  3826.       A text block field is not a "memo" field. It can be indexed and
  3827.       derived.
  3828.                                 - 142 -
  3829. ................................................................................
  3830.       TIME                 
  3831. FIELD TYPE       
  3832.       The Easy Base "time" field has the eight character format:-
  3833.       11:20:20    (Hours:Minutes:Seconds)
  3834.       You can record time data in any format you wish by using a
  3835.       "Formatted Text" field but you must use a "Time" field if you
  3836.       wish to perform addition and subtraction operations on time
  3837.       values.  (in seconds)
  3838.       Time fields are automatically checked for validity.
  3839.       See Also:-  Maketime
  3840.                                 - 143 -
  3841. ................................................................................
  3842.       TIMEAMPM             
  3843. FUNCTION        
  3844. TIMEAMPM
  3845.       This function returns the hour ( 0 - 12) plus am. or pm. from
  3846.       the time field parameter.
  3847.       Ex. Timeampm(system time)
  3848.       Ex.
  3849.       -------------------------format----------------------------
  3850.       .Report header
  3851.                      Appointments for {Apps.Date Field}
  3852.       .List items
  3853.                 {Apps.Name Field      }   at  {Time Field}
  3854.       .End
  3855.       -------------------------code----------------------------
  3856.       declare output fields
  3857.          Apps.name
  3858.          Apps.date
  3859.          Time
  3860.       end
  3861.       print report header
  3862.       for apps with date = system date
  3863.          time = timeampm(apps.time)
  3864.          print list items
  3865.       next
  3866.       Acceptable parameters:
  3867.       System time
  3868.       Time field
  3869.       Maketime function
  3870.       Time expression
  3871.                                 - 144 -
  3872. ................................................................................
  3873.       TOTAL COPIES         
  3874. SYSTEM VALUE      
  3875. TOTAL COPIES
  3876.       Whenever a procedure enters a "FOR" loop qualified by "With
  3877.       fieldname = " the total number of records which match the
  3878.       qualification value is available in the system value
  3879.       "Total Copies"
  3880.       Total Copies is extracted directly from the index file and
  3881.       relieves you of a time consuming loop all the way through a
  3882.       form updating a counter.
  3883.       In other words:-
  3884.       for books with category = "fiction"
  3885.          count = count + 1
  3886.       next
  3887.       can be replaced with:-
  3888.       for books with category = "fiction"
  3889.          count = total copies
  3890.          exit for
  3891.       next
  3892.       Unlike "Total Records" the "Total Copies" value never includes
  3893.       records marked for deletion.
  3894.       NETWORK VERSIONS
  3895.       With the release of Network V1 the Total Copies system value
  3896.       has been replaced with a pseudo field Form.Total Copies.
  3897.                                 - 145 -
  3898. ................................................................................
  3899.       TOTAL RECORDS        
  3900. SYSTEM VALUE      
  3901. TOTAL RECORDS
  3902.       Whenever a procedure enters a "FOR" loop the total number of
  3903.       records in the form is available in the system value
  3904.       "Total records"
  3905.       Ex.
  3906.       The following code fragment updates a "Customer summary" form
  3907.       with the total number of customers in the "Customers" form.
  3908.       declare variables
  3909.         tot as number
  3910.       end
  3911.       for customers with acno = 1
  3912.          tot = total records
  3913.          exit for
  3914.       next
  3915.       for customersummary
  3916.          customersummary.totalcustomers = tot
  3917.          update record
  3918.       next
  3919.       Caution.
  3920.       Provided that the "For" loop is qualified by a "with" statement
  3921.       then the "Total Records" value is extracted directly from the
  3922.       open index file and is the total number of "Live Records".
  3923.       If you access the "Total records" value in an unqualified "For"
  3924.       loop then there is no index file open and the "Total Records"
  3925.       value is derived by dividing the forms file length by the
  3926.       record length. It therefore represents the total number of
  3927.       records in the form "Live" and "Deleted".
  3928.       NETWORK VERSIONS
  3929.       From the release of Network V1 the Total records value has been
  3930.       replaced by a pseudo field Form.Total Records.
  3931.       for customers with acno = 1
  3932.          for customersummary
  3933.             customersummary.totalcustomers = customers.total records
  3934.          next
  3935.          exit for
  3936.       next
  3937.                                 - 146 -
  3938. ................................................................................
  3939.       UPDATE RECORD        
  3940. PROCEDURE COMMAND   
  3941. UPDATE RECORD
  3942.       The "Update record" command is used to alter the contents of
  3943.       one or many records in a form.
  3944.       Ex.
  3945.       for stock with item = input.item
  3946.          stock.price = input.price
  3947.          stock.pricechangedate = system date
  3948.          update record
  3949.       next
  3950.       This example changes the price of a single "Stock" item.
  3951.       for employees with taxcode = input.oldtaxcode
  3952.          employees.taxcode = input.newtaxcode
  3953.          update record
  3954.       next
  3955.       This example changes the taxcode field of all the employees
  3956.       whose present taxcode is the same as the input screen
  3957.       "oldtaxcode" to the input screen "newtaxcode".
  3958.       for employees
  3959.          employees.taxcode = employees.taxcode + 60
  3960.          update record
  3961.       next
  3962.       This example increases the taxcode of all employees by sixty.
  3963.                                 - 147 -
  3964. ................................................................................
  3965.       UPPER                
  3966. FUNCTION        
  3967. UPPER
  3968.       Returns the Uppercase of a text field or variable.
  3969.       Ex.  Upper(postcode)
  3970.            < shows the postcode field in uppercase>
  3971.       Ex.
  3972.       '.......................
  3973.       declare output fields
  3974.          labelname
  3975.          labeladdress
  3976.          labelcode
  3977.       end
  3978.       for customers with maillist = "yes"
  3979.          Labelname = Upper(customers.name)
  3980.          Labeladdress = Upper(customers.address)
  3981.          Labelcode = customers.postcode
  3982.          print labels
  3983.       next
  3984.       Acceptable parameters:
  3985.       Quoted text
  3986.       Text field/variable
  3987.                                 - 148 -
  3988. ................................................................................
  3989.       V.A.T. FUNCTIONS     
  3990. FUNCTION        
  3991. V.A.T. FUNCTIONS
  3992.       Easy Base has a set of five VAT rates which can be altered from
  3993.       the utilities menu. There are four VAT functions:-
  3994.          VATin
  3995.          VATon
  3996.          PlusVAT
  3997.          MinusVAT
  3998.       Ex.   VATin(retailprice,2)
  3999.              < Returns the VAT content of "retailprice" at VAT rate 2
  4000.       Ex.   VATon(netprice,4)
  4001.             < Returns the VAT to be added to "netprice" at VAT rate 4
  4002.       Ex.   PlusVAT(netprice,3)
  4003.             < Returns the VAT inclusive price at VAT rate 3>
  4004.       Ex.   MinusVAT(retailprice,2)
  4005.             < Returns the net price of "retailprice" before VAT at
  4006.               VAT rate 2>
  4007.        (assumes Retailprice as VAT Inclusive and Netprice exclusive)
  4008.       If the second parameter (rate) is omitted from any of the VAT
  4009.       functions then Rate 1 is assumed.
  4010.       Ex.   Gross = PlusVAT(input.net)
  4011.             < The variable "Gross" = the VAT inclusive of the input
  4012.              screen field "net" calculated at rate 1.>
  4013.       Although the VAT functions are primarily included for business
  4014.       applications, they can be used for any purpose where a
  4015.       percentage needs to be changed globally throughout an
  4016.       application without the need to alter each procedure or field
  4017.       derivation in which it is used.
  4018.       Acceptable parameters:
  4019.       1   Any numeric value, field, variable, expression or function
  4020.       2   As Parameter 1 but evaluating between 1 an 5
  4021.                                 - 149 -
  4022. ................................................................................
  4023.       Write                
  4024. File Command      
  4025. Write
  4026.       The "Write" command writes data to a non Easy Base file which
  4027.       has been opened with the "Open" command.
  4028.       The Syntax is:
  4029.       Write (Text, Variable, Field or Function) [Line_len (length)]
  4030.       The Line_Len keyword and parameter are not required.
  4031.       Ex.
  4032.       Write "Once upon a time"
  4033.       Write LineVar
  4034.       Write Customers.name
  4035.       Write Jointext(customers.forname," ",customers.surname)
  4036.       Write Customers.notes line_len 60
  4037.       Notes:-
  4038.       The contents of a text field is supplied without leading or
  4039.       trailing spaces. The contents of a text variable is supplied
  4040.       without trailing spaces. You can pad the output with either of
  4041.       the functions "Spacepad" or "stringof".
  4042.       The following code writes customers names and account Nos in
  4043.       two columns to an ASCII file.
  4044.       Open "C:\WP\NAMES.TXT"
  4045.       for customers with name in order
  4046.          write stringof(5,chr$(32))
  4047.          write spacepad(customers.name,30)
  4048.          write customers.acno
  4049.          write chr$(13)
  4050.          write chr$(10)
  4051.       next
  4052.       The contents of a text block field is supplied reformatable ie
  4053.       a single CHR$(13) is used to denote where a new line is to be
  4054.       forced. If you write a text block field without the Line_len
  4055.       keyword it will be written in this format.
  4056.       To write a text block field as ASCII Lines use the Line_Len
  4057.       keyword. The Line_Len value does not have to be the same as the
  4058.       width of the text block field. Easy Base will word wrap the
  4059.       contents to whatever Lin_Len value you supply.
  4060.       You cannot write quotation marks within quoted text.
  4061.       To write "Fred said "@*!" to Bill" you must replace the inner
  4062.       quotation marks with ASCII character 127. (Hold down the Alt
  4063.       key and type 127 on the numeric keypad)
  4064.       See also: Open, Close, Read, Seek, Find
  4065.                                 - 150 -
  4066. ................................................................................
  4067.       YEAR                 
  4068. FUNCTION        
  4069.       This function returns the year number from a date parameter.
  4070.       Ex.    Year(system date)
  4071.       Ex.
  4072.       Carage = jointext((year(system date)-year(registered))," Years
  4073.       old")
  4074.       Acceptable parameters:
  4075.       System date
  4076.       Date field
  4077.       Makedate function
  4078.       Date expression
  4079.                                 - 151 -
  4080. ................................................................................
  4081.       ZEROPAD              
  4082. FUNCTION        
  4083. ZEROPAD
  4084.       The Zeropad function pads an integer or fixed point field to a
  4085.       given number of places left and right of the decimal point.
  4086.       Ex.  Zeropad(price,3,2)
  4087.            <Returns "001.50" if price = 1.5>
  4088.       Ex.  Zeropad(acno,6,0)
  4089.            <Returns "004532" if acno = 4,532>
  4090.       The Zeropad function can be used as in the second example to
  4091.       return a fixed length numeric string from an integer field.
  4092.       It's main use, however, is in the creation of fields for
  4093.       compound indices where one of the fields to be compounded is a
  4094.       number.
  4095.       For example: A school has all pupils names and ages recorded on
  4096.       a form in fields "name" and "age". To create an index which
  4097.       will list pupils names alphabetically but grouped by age a
  4098.       compound field which is invisible and does not allow user entry
  4099.       is created as a text field derived with:-
  4100.       Jointext(zeropad(age,2,0),name)
  4101.       Because the compound field is text the index file will be
  4102.       sorted alphabetically. If you sort the numbers 8,9 and 12
  4103.       alphabetically you get 12,8,9 because the one in 12 comes
  4104.       before 8. If however you sort the numbers 08,09 and 12
  4105.       alphabetically you get the correct numeric order.
  4106.       By using the zeropad function in the above example and indexing
  4107.       the compound field,let's call it "unifield" you could then
  4108.       print out the pupils in age groups with the names in each group
  4109.       arranged alphabetically.
  4110.       .........................format.................
  4111.       .group header
  4112.        Pupils aged {pupils.age field}
  4113.       .list items
  4114.               {pupils.name field}
  4115.       .end
  4116.       .........................procedure code.........
  4117.       declare output fields
  4118.          pupils.name:pupils.age
  4119.       end
  4120.       declare variables
  4121.          agecheck as number
  4122.       end
  4123.       agecheck = 0
  4124.       for pupils with unifield in order
  4125.          if pupils.age <> agecheck then print group header
  4126.          agecheck = pupils.age
  4127.          print list items
  4128.       next
  4129.                                 - 152 -
  4130. ................................................................................
  4131.